Questions tagged [templates]
Questions related to the ExpressionEngine "templating" system.
556
questions
17
votes
4
answers
2k
views
What does "Enable Strict URLs" really mean?
What does "Enable Strict URLs" really mean and are there any security/other implications if I choose to not use strict URLs?
17
votes
3
answers
385
views
What is the best way to handle a matrix field in Stash
I have the following code in a template that I use to prepare the data for an embedded template using the Stash partials approach. It is for a single entry page that draws data from an entry that can ...
15
votes
2
answers
3k
views
What is the difference between a global variable, a snippet and an embedded template?
What is the difference between a global variable, a snippet and an embedded template?
When and where should I be using each of them?
12
votes
11
answers
7k
views
How to make templates output JSON?
I am trying to use EE templates the same way I use CI controllers. Normally, when I need an "API" wherein my JS can call a URL (maybe with some POST variables) and get a JSON (or JSONP) response back, ...
7
votes
2
answers
526
views
Embedding Low Variables within Low Variables i.e. preparse
So I'm taking an existing site and cloning it to use for another site. The thing is the existing site was built a long time ago and has several template insufficiencies including embeds nested 3 ...
7
votes
5
answers
2k
views
How to strip white space in EE?
I'd like the rendered markup to be absent any carriage returns, line feeds, or tabs. I'm looking for a functionality similar to Smarty's {strip} tag. Does EE have this?
7
votes
1
answer
529
views
Benefit of Saving Templates as Files
Aside from being able to edit files without the Template Manager – is there any advantage to saving templates as files in ExpressionEngine?
Does it improve performance, security, etc.?
Would be ...
7
votes
1
answer
802
views
Variables in templates w/o PHP enabled
I have a problem where I need to increment a variable if it satisfies a conditional like so:
{matrix_tag_pair}
{if matrix_column_name}
$increment++
{/if}
{if $increment > 9}
do this....
7
votes
1
answer
369
views
Site "forgot" what the default template was
I've had the same problem happen a few times, on several different EE sites, but I can't determine the cause so I'm turning to y'all.
Symptom: The site's main index page will fail to load and will ...
6
votes
8
answers
2k
views
How to use a common template for all pages?
Is it possible to define some container template that might contain my <html> declaration, then inside it it'll just embed other templates depending on the page? Right now, I'm having to declare ...
6
votes
3
answers
3k
views
How can I manually parse template code from PHP?
Is there a way to evaluate an ExpressionEngine template using PHP in a custom plugin?
I am using the Widgets plugin and want to create a custom widget type. I would like to define the widget output ...
6
votes
2
answers
435
views
How to structure a category listing template?
What is the best way to create a category listing page where the category name is used in both the <head> and <body> tags?
This is what I have at the moment:
<!DOCTYPE html>
<...
6
votes
1
answer
10k
views
How to Display an Entry's Category?
I'm on a single product entry page. The URL does not specify the category. In fact, the entry has 3 category groups associated with it. I want to display the first category assigned from each of the ...
6
votes
1
answer
186
views
template_fetch_template hook $row parameter
I'm considering writing an extension that greatly depends on hooks that are available before and during template parsing. I see in the ExpressionEngine hook documentation that there is a hook called '...
6
votes
1
answer
336
views
A way to limit the number of categories with `exp:channel:categories`?
Is it possible to limit the number of categories that are returned by the {exp:channel:categories} tag? If not is there an alternative (or dare I say add-on :P)
Obviously I could just use an SQL ...
6
votes
3
answers
68
views
Is there a way to add logic operand to the search parameter?
I am looking for a way to isolate entries based on a {event_time_start} and {event_time_end} custom field. For instance the first one contains 930 as a value and the second one 1200 meaning the event ...
6
votes
2
answers
1k
views
How to add cache headers to EE responses?
I have found that caching templates has greatly improved performance. But how can I further improve performance by having EE include cache headers to prevent the browser making the same requests time ...
5
votes
3
answers
728
views
Sticky Navigation Bar
I have set up my site in ExpressionEngine and I am trying to create a sticky navigation menu which indicates the section of site the user is on. Click Here for example when the user click on about the ...
5
votes
7
answers
5k
views
How to escape special HTML characters in output?
It is commonly useful to escape encode special HTML characters in output to avoid breaking output attributes (among other reasons):
Take the following seemingly innocent template snippet:
<!...
5
votes
4
answers
555
views
Trigger a 404 on a /news index which has categories and pagination running through it
I've yet to come up with a decent solution for this so thought I'd throw this out there.
Basically I have a /news/index template, it serves the initial set of news results, and also serves up ...
5
votes
4
answers
769
views
EE Code within channel entries
Is it at all possible to have a text input or area field in which we could enter EE code to be processed by the template.
For example, if we could have a text area called "Advanced Functionality" and ...
5
votes
3
answers
439
views
How do I get a member login form on the offline template?
We typically demo new EE sites to clients with the site in "offline" mode, which prevents unauthorized access and requires the client to login before they can see anything. Previously we've either ...
5
votes
3
answers
146
views
What's the limit on entry views tracking?
Does entry views tracking allow you for 4 instances all together or 4 instances per channel?
5
votes
3
answers
297
views
Breaking my HTML into tiny pieces - template, snippets, or globals?
In order to maximize code reuse, I'm trying to break down the mark up for each of my form fields into individual "containers" (e.g. a template, snippet, global). The project I am working on is form-...
5
votes
4
answers
715
views
How to create a complex stockist list using Structure and/or categories
After struggling for a day I hope that someone may be able to help me. I have a site that has a list of stockists worldwide. I would like to have a landing page where you can choose your country (...
5
votes
5
answers
1k
views
displaying expired entries
Is there a way where i can create a function that only displays expired entries? I have a page set up that displays, up and coming and pervious events click here when the user clicks on the pervious ...
5
votes
3
answers
720
views
Turn off Message Pages after login?
Is there any way to 'turn off' the Message pages that briefly show after a login, logout, etc.?
5
votes
1
answer
289
views
Re-writing Playa tags to disable the Playa extension for better site performance
With the overall goal of reducing page load time (Memory, Execution Time in template debugging), how can I rework my Playa templates so as to “shut off” the Playa Extension?
Template debugging shows ...
5
votes
4
answers
979
views
Cannot change the template assigned to an entry item
I am working on a complex EE site (version 2.5.2) that I've been handed that has a large number of templates. I wish to customize the template for a specific entry. I have created a duplicate of the ...
4
votes
5
answers
452
views
Custom fields on comments?
Is there a way to add custom fields to content comments?
For example, I would like to add a date input field and a subject field.
Alternatively could this be accomplished with the Solspace plugin "...
4
votes
2
answers
5k
views
How to run a php script silently (like a cron job) from an EE template
I've got a PHP script that updates an entry's status depending on certain criteria being met. I was planning on running this script as a cron job on my web server every hour.
It'd also be nice if I ...
4
votes
3
answers
2k
views
Channel Entries - possible to search relationship field?
I need a list of all entries filtered by a relationship field. I thought I might be able to use the search parameter: http://ellislab.com/expressionengine/user-guide/modules/channel/channel_entries....
4
votes
5
answers
2k
views
Template file not synchronizing to cms?
I have been given an expressionengine site to work on. This is my first time using expressionengine.
I am trying to make some changes to a template file. I have uploaded the file to the webserver. I ...
4
votes
2
answers
182
views
How can I quickly create files for all of my templates?
I'm working on a site with hundreds of templates that were all saved in the database. If I run a query to change "save_template_file" to "y" and then run synchronize, will that work? Any horror ...
4
votes
2
answers
46
views
How to make singular instance of text editable in a template
Is there a good workflow for making a singular instance of text, like an intro paragraph, editable within a template?
I find this comes up a lot and the channel entry workflow is really built around ...
4
votes
2
answers
1k
views
How to approach static content
I've been struggling with static content and wanted some other opinions on how to best approach it.
Currently, I have a channel called Static Content where I, obviously, post all the "static" ...
4
votes
1
answer
220
views
What is best practice for protecting templates saved as files?
I've just discovered that all of the templates I'm saving to the filesystem are accessible through the browser if the name is known, and now I've got a case of the screamin' heebie jeebies.
For ...
4
votes
1
answer
82
views
Why is the word "random" treated differently in the template parser?
We are experiencing some PHP errors due to a "too large" regular expression that is taking place during template parsing in Template.php. We noticed it was only occurring on templates that load an ...
4
votes
1
answer
1k
views
How to set and access session in EE?
SEE: http://ellislab.com/forums/viewthread/224965/
I need to display something to the user only once. How do I do this in the templates? My idea is to store a value in session and use it to decide ...
4
votes
1
answer
298
views
TMPL->parse_variables_row() not available in model?
I have a model (core_model.php) with lots of functions in there, however having an issue with the following one in specific :
Class core_model {
function __construct(){
$this->EE =&...
4
votes
3
answers
129
views
alternative to php var in template?
It's been a solid year since my last ee project. The things you forget over time :)
At the top of my template I show the latest featured entry (limit="1" search:featured="yes").
Later in my template ...
4
votes
1
answer
354
views
Is there a way to disable auto-convert URLs and email addresses into links for custom member fields?
I have created a custom member field, {Google_Plus_URL}, where a URL like, https://plus.google.com/1051794532082275037724 can be entered.
In my template, I reference this field as such:
{if ...
4
votes
1
answer
618
views
Using Mo' Variables in Module Tag Parameters
I'm using Mo' Variables for the early-parsed request variables. Here is the best-case scenario:
{exp:calendar:cal
date_range_start="{if get:start}{get:start}{if:else}today{/if}"
...
4
votes
1
answer
807
views
ExpressionEngine Rich Text - the HTML Output is coming out weird
In EE's Rich Text editor, I typed in the following content.
I did not do any fancy markup or formatting.
All I did was set each heading to an H4, and typed paragraphs normally.
I did not touch the ...
3
votes
3
answers
1k
views
Is there a standard way to do 404 pages with structure?
Is there a standard way to do 404 pages with structure? Many thanks!
Ben
3
votes
3
answers
2k
views
How to link JS in template files ala CSS?
I like this feature for linking CSS within the templates:
<link href="{stylesheet='styles/main'}" rel="stylesheet">
The great thing about this is that it does versioning automatically, which ...
3
votes
3
answers
262
views
DevDemon Updater Error or My Fault?
I am using DevDemon Updater for the first time, so bear with me if I am being dense.
I updated the site from v2.3 to v2.5.3 last night along with Matrix and Wygwam.
But for some reason, I noticed one ...
3
votes
2
answers
1k
views
Unformatted Field Data Wrapped in <p> Tags on Output
I have a text field with formatting set to "none". In the database, the data for that field is stored exactly as it should be: as plain text with no html tags.
When I drop the field tag into my ...
3
votes
3
answers
653
views
How to filter channel by numeric field?
If I have a channel with the custom field "Age" (numeric type) how can I filter the channel so that only entries with "Age" >= 24 are shown?
Likewise what would be the way to define and filter a ...
3
votes
2
answers
641
views
Disable database-templates within ExpressionEngine 2
I'm working on EE2 theme and I can't find solution how to force EE use templates directly from the file system.
Generally I want to disable database templates while I'm working on theme, to get ...