Hot answers tagged

17

{exp:channel:entries channel="my_channel" orderby="price" sort="asc"} Ordering entries by custom fields comes by default with ExpressionEngine: http://expressionengine.com/user_guide/modules/channel/channel_entries.html#orderby


13

If you just need to modify the part of the URL before the pagination segment (and your use case is relatively simple) you can use the paginate_base parameter on your entries loop (docs here): {exp:channel:entries paginate_base="blog/foo" {pagination_links} {page} <a href="{pagination_url}">{pagination_page_number}</a> {/page} ...


10

To add an entry to EE, you need to enter data in a minimum of two places: an entry in exp_channel_titles and a matching one (by entry_id) in exp_channel_data. The entry_id field is not auto-incremented, and so you're best to enter the data in a transaction, in case the (very rare) circumstance happens where the control panel is used to add an entry just as ...


9

I think the easiest way would be to make sure that your call to the css file is within your channel entries loop and that you name your css files the same as your channel short names. {exp:channel:entries limit="1"} <head> <link href="path/to/css/folder/{channel}_styles.css" rel="stylesheet" /> </head> <body> {title} {...


9

I don't mean to be presumptuous, but you do know that you can assign the same field group to multiple channels, yes? That is the only way to use the same field in more than one channel. Some people like to make one single field group that includes fields for their whole site, assign that same group to all channels, and then simply hide the unnecessary ...


8

This is actually simpler than it seems. For this URL, events/calendar/2012-12 , use this code: {exp:channel:entries channel="calendar_images" limit="1" orderby="random" dynamic="yes"} Content {/exp:channel:entries} Assuming there's a template group called events, and a template called calendar, it'll display the entry matching the url_title 2012-12 ...


8

You cannot use OR clauses inside of a {exp:channel:entries} tag. The best way to handle this would be to write a custom plugin that would do the selection, or use the Active Record plugin. You should not use the built-in Query plugin because it unsafe to pass user-submitted values (such as {segment_*} variables) to this plugin, while the Active Record ...


8

A quick addendum to the other answers (which are both fine for reading back values): it is possible (and often a good idea) to change a text input field's allowed content from the default "all" to "integer", "number", or "decimal". You can do this on the edit field screen: This is important to do if you then want to filter/sort values numerically rather ...


8

There are two add-ons that are very useful for single-entry channels: As Jeremy mentioned, Single Entry (great add-on!) or CP Menu Master -- also a useful add-on (formerly "Hidden Channels"). Either of these will remove the given channel from the Content > Publish menu, making it less likely for the end-user to be confused and publish additional entries in ...


8

In the grand scheme of things, it's advisable to simply use such a field in each field group that requires it, since add-ons that would give you the ability to place a single custom field into multiple field groups (thinking back to the gypsy days) can complicate ongoing support and in particular your upgrade path in the future. There are ways to make that ...


8

Personally I would create a different field in each as sharing fields across channels has in the past caused me a number of issues when unforseen changes need to be made to the site. I'd perhaps then use a naming system for my fields - something like; {channelA_shortname_image_description} {channelB_shortname_image_description} e.g. your fieldnames might ...


8

This parameter is confusing, and has been the subject of much consternation. As per Travis' comment on the docs page: If an entry is in two categories, cat_id 1 and cat_id 2, and you ask for just entries with category="not 1", the entry will still show up in the output. This is because it is in category 2. This may not be the behavior you expect. Also ...


7

Run this query in you SQL browser/tool/contraption of choice. SELECT exp_channel_data.entry_id, exp_channel_titles.entry_id FROM exp_channel_data LEFT JOIN exp_channel_titles ON exp_channel_data.entry_id = exp_channel_titles.entry_id WHERE exp_channel_titles.entry_id IS NULL This will give you a list of entries in your exp_channel_data table that don't ...


7

This is a bug introduced in 2.5.3 - There's a hotfix here: http://expressionengine.com/bug_tracker/bug/18239/


7

If the project has relatively low needs in terms of site-wide data (read, If you don't need custom fields), then I tend to store these in global variables and snippets. When I need to store more advanced content, I personally use low variables. Pretty much a default now on medium or big EE builds. You can then use custom fields like Matrix, Wygwam, playa, ...


6

Generally the best option is to use DataGrab. It can import from CSV files, as well as XML and other formats. The field_ft_x column stores the field "type". This is different from the fieldtypes you are probably thinking of though. For example, a "textarea" field has the option to choose which format it's in - things like None, Auto BR, HTML. You can also ...


6

On a single entry page (ie one with a url_title or entry_id in the URL) you can use the require_entry="yes" parameter, by using this in conjunction with the {if no_results} conditional, to only show a "proper" page when a valid entry is passed. {exp:channel:entries require_entry="yes"} {if no_results} {redirect="site/404"} {/if} <h2>{title}&...


6

If when you say "performance" you mean system performance the n it would probably be moot - as no matter what combination of channels and fields you put into EE at the EE database level you are just extending the same tables. In other words one EE channel does not equal one EE/MySQL table. But by performance you could also mean Content Manager ...


6

You can create custom tabs on the publish page and choose which fields they contain. Just click the 'show toolbar' link on the upper right hand side of the publish page and you'll see these controls: Individual fields can be hidden by clicking on the little eye icons. Tabs can be created via the Add Tab link and populated by dragging and dropping field ...


6

Low Alphabet will let you generate alphabetically ordered channel entries with the option to define ignore words like 'the' and 'a'.


6

Remove safecracker_file from your third_party directory. It has been deprecated (now rolled into the standard File fieldtype).


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

Did you try using out_global like so: {exp:mx_jumper:out_global} {exp:channel:entries channel="blog" limit="1"} <h1>{title}</h1> {exp:mx_jumper:put name="test"}Move this content to outside the loop{/exp:mx_jumper:put} {/exp:channel:entries} {/exp:mx_jumper:out_global} {exp:mx_jumper:out name="test"} or you could also do: {exp:mx_jumper:...


5

One addendum to the other answers (though they are perfectly correct) that may be relevant to you given your choice of sorting field: It's worth noting that if you want your price field ordered data to be ordered numerically in order of increasing/decreasing scale, you will need to change the field content type to decimal (assuming decimal prices). To do ...


5

You could do this combining Stash and the allow_eecode plugin. http://www.tyssendesign.com.au/articles/cms/more-stash-examples/ has a great example of the functionality you're trying to achieve (example 1 wp shortcode). For stash see https://github.com/croxton/Stash, allow_eecode http://devot-ee.com/add-ons/allow-ee-code


5

Stash, yet again(!), is the answer: {exp:channel:entries} {exp:stash:parse process="end"} {advanced_functionality} {/exp:stash:parse} {/exp:channel:entries} ... this does the trick for parsing snippets Then if you want to get more creative with custom shortcodes instead of snippets, you'd use stash:set first like this: {exp:stash:set name=...


5

As mentioned already, Single Entry is brilliant to do this sort of thing. A great example would be your 'home' page entry. You might have a channel called 'home' with a single 'home' entry. The Single Entry add-on is great for that. For Company Details (which is the example given) that are used in the site, I would tend to go NOT having them in a single ...


5

Not a channel per page, closer to a channel per section. If you think of pages as the final contact, like an individual post, a single product description or say a mission statement; then sections are what groups them. A section would be what separates, all the content related to say your About Us area versus say all your organizations research, blog posts ...


5

There is not - although you could add some javascript to do so (using, for example, the CP CSS & JS add-on). This would be a good feature request for Pixel and Tonic to add to their P&T Field Pack fieldtypes.


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