We changed our privacy policy. Read more.

Hot answers tagged

9

Use the built-in Stats module: {exp:stats channel="products"}{total_entries}{/exp:stats} Or the Query module: {exp:query sql="SELECT total_entries FROM exp_channels WHERE channel_name = 'products'"} {total_entries} {/exp:query} http://ellislab.com/expressionengine/user-guide/modules/statistics/index.html#total-entries


7

The query module would do nicely here. Unless the information rapidly changes and 100% accuracy is necessary, I also recommend tag caching if the page itself is not cached. {exp:query sql="SELECT COUNT(*) AS total FROM exp_channel_titles t WHERE t.channel_id = 1 AND t.status IN ('open', 'featured') AND t.entry_id IN (SELECT entry_id FROM ...


7

From performance view is better to use query for this: {exp:query sql="SELECT count(*) as total_results FROM exmx_channel_titles WHERE channel_id = '2' "} total results: {total_results} {/exp:query}


4

I think GWcode Categories would be the easiest way to do this: http://gwcode.com/add-ons/gwcode-categories. It can also do a great number of other things with categories. There's also an add-on just for counting category entries: http://devot-ee.com/add-ons/category-count I actually use both on my site. I don't think there is a native way to do this ...


4

In the control panel go to Admin › Utilities › SQL Manager › Database Query Form In the query form put SELECT COUNT(*) FROM exp_weblog_titles; This will give you the total number of entries on your site. If you would like to know the number of entries in a specific Weblog you can do SELECT COUNT(*) FROM exp_weblog_titles WHERE weblog_id = X; ...


3

I've added a {ce_counter} variable to the elements loop. Open the ft.content_elements.php file and navigate to the replace_tag function. Insert $i_counter = 0; just before the foreach $data loop. In the loop, look for the // Counter section and add: $i_counter++; $tagdata_parsed = str_replace('{ce_counter}', $i_counter, $tagdata_parsed); In the loop, ...


3

Maybe there's a better native ee way without enabling php, but I would use Stash or Low Search. Use Stash (set_list) to set a list of all your search results and then you could have more control over outputting for each tab/channel (using get_list). When you set your list set a variable for channel (i.e.: "my_cached_channel_var"), and then when you output ...


3

Are you trying to get the count of multiple playa entries for each matrix row? If so, you should be able to do something like the following, setting a different namespace prefix for matrix and playa to separate their tags: {your_matrix_field_name var_prefix="mx"} Matrix row {mx:row_count} of {mx:total_rows} total rows.<br> {mx:...


2

The most simples way for this is used switch tag <ul class="touchcarousel-container"> {exp:channel:entries channel="track_record" dynamic="off"} {switch='<li class="touchcarousel-item">|'} <div class="balk"><p>{title}</p></div> {exp:ce_img:single ...


2

The hits for templates are stored in the exp_templates table. The column is called "hits". Generally speaking though I think that you might get a more accurte idea on where the hits are coming from if you use Google Analytics.


2

Faffing about with loop counters is quite unpleasant and inelegant... these are the kind of problems you run into when your data-fetching is tightly coupled to your data-output. Instead put Stash to work. Here's how: {!-- ============================================ STORE THE DATA into dynamic stash lists using context. Avoid the temptation to put any ...


2

You should be able to simply add: SUM(t.view_count_one) as view_count ... to your SELECT statement.


2

The variable which returns the total amount of entries is {absolute_results}, not {absolute_count}. {exp:channel:entries channel="people" search:people_alpha="={segment_3}"} {if count == 1} <h3>{absolute_results}</h3> {/if} {/exp:channel:entries}


2

Unless there are other reasons why not use {exp:channel:entries offset="3"} Then inside the channel tag use the {if no_results}...{/if} to handle no content. https://docs.expressionengine.com/latest/channel/channel_entries.html#offset


1

It might work out easier to turn this into a short plugin, but would a query like this work? You'd need to pass in the id of the channel you're looking for. {exp:query sql="SELECT count(*) AS totaled FROM exp_channel_titles WHERE channel_id='{channel_id}' AND status='open'"} {totaled} {/exp:query}


1

I solved my problem by using php. First i go through all of the categorys and count them. after that i check it with another variable where i count the current Category. [ {exp:channel:entries channel="ch_efn_magazin" entry_id="304"} { "ID": "{entry_id}", "Category": [{ <?php $maxCat = 0; $currentCat = 0; ?> {categories} ...


1

I can't tell because you didn't post enough code, but it looks like you have a {exp:channel:entries} loop inside of another loop, possible another channel loop. This isn't going to fly; the parse order of the templating engine won't render the output you want properly. You need to extract that inner loop and put it in an embed. http://ee2docs.com/templates/...


1

You're getting the total of all related articles because you're not specifying that you need to group the results by entry. Try: SELECT t.entry_id, t.title, COUNT(r.child_entry_id) AS entry_count FROM exp_channel_titles AS t INNER JOIN exp_playa_relationships AS r ON t.entry_id = r.child_entry_id WHERE r.parent_field_id =...


1

I found it! I was trying to use a LV field tags to get the row count of a matrix field while I needed to use the matrix field tag {row_count}. {exp:low_variables:pair var="lv_Form"} <div class="radio-style"> <input type="radio" id="dest_0{row_count}" name="destination" value="0{row_count}" /><label for="dest_0{...


1

Since the version 2.9 of eecms, the expected format for conditionals is {if var:count > 0}. Some addons make necessary to use {if "{var:count}" > 0}, but just because of the way the developer coded the addon. As the conditional is related to a 1st party module, probably the first option will work fine. Please, try: {if select_testimonials:count > ...


1

Maybe a little bit of javascript/jquery to do it on the client-side :-) (1) jQuery Move / direct the stuff into the correct tab. First set a default <li> for each tab with a not-found message, this can be replaced or removed after the result is set. // all items {chan:entries} <li class="item {channel_short_name}">text</li> // jQuery $("#...


1

View counts are stored in the exp_channel_titles table - view_count_one, view_count_two, etc.


1

Switch is the correct way to do this, on a related note the new Modulus operator introduced in 2.7.1 can also help in similar cases. [http://ellislab.com/blog/entry/the-modulus-operator][1]


1

I suggest that you do not use separate entry for each slider, but have one entry with 2 custom fields: slider caption (text field) slide images (Matrix or Grid field) This way, you will simply loop over Grid/Matrix field while staying in same Channel entry.


1

The Number member entries plugin looks like it should do the trick. Channels do have a channel_id, but I can't find it in the EE control panel easily. You could count the number of channels down from the top of your Channels list (under Admin > Channel Administration > Channels). You could also use the Developer Info add-on to find the channel_id. {if ...


1

If you use some custom text field to keep timestamp, in this case I think you need activate php and set it to be parsed on "input": <?php $beginOfDay = strtotime("midnight", ee()->localize->now); $endOfDay = strtotime("tomorrow", $beginOfDay) - 1; ?> {exp:channel:entries channel="LIVE_STREAM" search:timestamp_field="<&...


1

Certainly on the front end, one of the options would be to simply use jquery to do that work for you. A quick search revealed one method that would likely do the trick - you would surround the article body requiring a word count with a class of "to_count" and then use jquery with a bit of regex to detect and count the words within that class element. This ...


1

In 2.7.3 there are variables within grid, see http://ellislab.com/expressionengine/user-guide/modules/channel/grid.html#variables {fieldname:count} //the current row being displayed {fieldname:field_row_count} //how many rows are in the grid {fieldname:total_rows} //the rows being returned by the query


1

This can be done a couple of ways. 1 - manually! enable PHP in the template and doing it that way. 2 - addon, i have used one before that i cannot quite track down now... but something like TALLY should do the job, try playing over at devot-ee: http://devot-ee.com/add-ons/tally I might have even created a simple plugin myself to do this in the past. I ...


1

Jason, is JavaScript totally out of the picture for this? Also, what's your PHP expertise like? I've solved similar issues in the past using a custom plugin and a static PHP variable. Basically, you can try setting the channel:entries field around the matrix to parse="inward", so it runs first, and have a plugin with a method that outputs and increments a ...


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