Hot answers tagged

6

Conditionals based on URL Segments is how I would handle this. For your example, I would have in my books/chapters a conditional like {if segment_2 == "summary"} {embed="embeds/summary_code"} {/if} I'd use an embed just to keep the template cleaner — instances where I do this do tend to be on more complex site where I like keeping things as clean as ...


6

Your option is a good one and not hard at all. Instead of expiring the entries, I would future date them and set limit="1" on your channel:entries tag. This way an entry will always appear. With expiring you risk human error causing an image not appearing.


5

I recommend using SEO Lite. It will save you from having to open up a channel:entries tag just to grab the title. Plus it can be used for a meta description tag (which is also useful for og:description and social share text). And it has a variety of useful parameters to help you pull the right title and to add prefixes or suffixes to your title. Just ...


5

Now that ExpressionEngine includes a modulus operator (as of 2.7.1), you can also use that instead of switch if you prefer. Put the first html block's opening tag and the final block's closing tag outside of channel:entries and use modulus to conditionally close and re-open blocks of html: <div class="item-container active"> {exp:...


5

There is no direct way. I suggest you to install this module Edit If incase you have values to pass with comma separated (i.e., 5,00,000.05), You need to edit pi.math.php file to add this code on line number 54. // remove commas $formula = str_replace("," , "" , $formula);


4

Another simple idea... Name your images like this: December-1.jpg December-2.jpg December-3.jpg Manually upload the images to the server... in your template call image like this: <img src="/path/to/images/{current_time format="%F-%j"}.jpg"> The image for the current day will always be called. EE date formatting options are here: http://ellislab....


4

You need to ensure that you have created a Channel Field Group and assigned that to your Channel (News). Then, make sure that you have created at least one field in your Channel Field Group. In this case it would be a Textarea Field Type with a name of body. Then in your Publish/Edit screen for your Channel you'll see your new Body field. Once you enter in ...


4

You need to use the require_entry parameter: {exp:channel:entries limit="1" require_entry="yes" [...]} {if no_results} {redirect="404"} {/if} [...] {/exp:channel:entries} This parameter make the {if no_results} conditional available.


4

Form layouts is where you can setup the input form and fields for entering data via the Create or Edit entry pages. You can save a layout for specific users per channel so that a given user will see the entry form that you have saved to a layout. In this way, you can reorder or hide fields as needed. For example, say you have a user that you don't want to ...


4

Yes, this is possible. You can do this by making simple template and embed. Create one template template_name.html in your template group and insert below code. {exp:channel:categories channel="channel_name" disable="category_fields"} ******************************************************* <br> Category Name : {category_name} <br&...


3

Yes, you can pull content across sites. That the site setup process allows you to copy an existing site doesn't change that. You can embed templates across sites using an embed statement: {embed="default_site:embeds/html_header"} I'm not sure what you mean by sharing templates via a symlink.


3

Yes, use the Publish Layouts feature. You can drag and drop fields into place and adjust their widths as you please.


3

switch can help in this case: <div class="item-container active"> {exp:channel:entries channel="yourchannel"} <img src=".." /> {if count != total_results} {switch='|||||||</div><div class="item-container">'} {/if} {/exp:channel:entries} </div>


3

If you don't want to use channels, use low variables with a grid field with days of the week as the grid rows. Give each a file upload field and an alt field then use some logic on the template to get the day and call the low var for that day. Simple example, not verbatim code purely reference Grid field: date_1 | imgxx | alt title date_2 | ...


3

If you have Wygwam installed, I'd recommend taking a look at GWCode SyntaxHighlighter. http://gwcode.com/add-ons/gwcode-syntaxhighlighter It's served me well for years now, and since it's integrated as a Wygwam toolbar button, it allows you to mix prose and code all in one single field. Cheers, John


3

Alec's method works, but it might cause very high query counts due to the way EE generates nested Channel Entries tags. Take a look at the alternative method outlined in this post from EE Add-on superhero (and parse order master) Low. It achieves the same thing, but is much more performance friendly: http://gotolow.com/blog/nesting-tags-and-performance-in-...


3

As per your comments, you've already figured out the rather large annoyance of needing to pass all pre-existing fields with the save_entry function or else having them wiped out. I wanted to post an answer here though because there are a couple considerations I've come across when doing entry updates with my add-ons: 1) If you do not need the update to ...


3

With - http://ellislab.com/expressionengine/user-guide/add-ons/channel/entry_linking.html {exp:channel:next_entry} <p>Next entry: <a href="{path='site/comments'}">{title}</a></p> {/exp:channel:next_entry} {exp:channel:prev_entry} <p>Previous entry: <a href="{path='site/comments'}">{title}</a></p> {/exp:...


3

I'm pretty sure you can just pass in the fieldname the row and column like $data['field_id_X'][rows][new_row_1][col_id_1] = 'row 1'; $data['field_id_X'][rows][new_row_2][col_id_1] = 'row 2'; Just increment new_row_x as needed and match up your col_id_x numbers


3

Thanks to @Nevsie-Modeten, I reworked the query to the following: {if {current_time format='%w'} == 0 && {current_time format='%G%i'} >= 930 && {current_time format='%G%i'} <= 1230 } Content to be displayed during this time. {if:else} Content to be displayed during other times. {/if} This checks the day and time and ...


3

The simplest and and most flexible way is to use Template Layouts. In your main HTML Layout wrapper (simplified) which we will say is named "_html-layout" in the "layouts" template group: <html> <head> <link rel="stylesheet" href="/css/global.css"> {layout:css_extra} <head> <body> {layout:contents} </body> &...


3

I'm really confused by your question, but I'm going to make an attempt at clarifying some base concepts that I think you are wrongly assuming about a commercial grade CMS (content management system) like ExpressionEngine, and CMS's in general (possibly, not trying to say you don't know what you are doing). First of all, this is a content management system. ...


2

Checkout the EE syntax plugin from Eric Lamb at Mithra62: http://devot-ee.com/add-ons/ee-syntax I think that will help you do what you are looking for. It formats code based on the geshi library and supports a number of different syntax highlighting formats.


2

Can you not just use the standard file field and set up a folder for backgrounds? Your client can then either select an already-uploaded image from the list of files, or upload a new one. You can restrict this field to one folder so there's no room for confusion and have it as a field in your pages channel. This way you don't have two separate strands to ...


2

The Variables plugin is a good option for passing data to the header embed. The variables plugin gives the possibility to create variables (either static or dynamic) and use them later on. This means that for example you can set certain data and use it in the head (if it's embedded) without having to re-create a tag pair for the specific channel. ...


2

You'll want to use something like this: {exp:channel:entries channel="your_channel" category_group="your_cat_group" category="2&3" dynamic="no"} My understanding of it is as follows: "2&3" - This returns all entries which are tagged as belonging to 2 AND 3. "2|3" - This returns all entries which are tagged either 2 or 3. So, the first will only ...


2

I needed this for a recipe website once and the code below seemed to do the trick: {exp:channel:categories channel="products" style="linear" show_empty="no"} <h2>{category_name}</h2> {exp:channel:entries channel="products" dynamic="no" limit="3" orderby="random" category="{category_id}" } {title} {/exp:...


2

You could also use the new modulus operator: {exp:channel:entries channel="yourchannel"} {if count % 8 == 1} <div class="item-container active"> {/if} <img src=".." /> {if count % 8 == 0 OR count == total_results} </div> {/if} {/exp:channel:entries}


2

Brad, i've got something similar working on a local site. Was able to achieve what you're trying to do using a similiar addon by the same developer GWcode CatMenu You can use my code as a starting point.. <nav id="menu"> {exp:gwcode_catmenu cat_url_title="{segment_1}" } {if no_results}<!-- if no valid category was provided in the URL segment show ...


2

You need to write custom script for this. You can find script example on Structure support forum. My small modification of this script (you need to create template with rights to run php code) !make DB backup before run the script! <?php /** * Batch reset template_id for Structure entries */ $site_pages = ee()->db->query( "SELECT site_pages ...


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