limit and pagination not working in expression engine exp:query - expressionengine

What is wrong in this code that is not allowing me to show only two records along with pagination any help highly appreciated?
{exp:channel:entries channel="article" status="open" orderby="date" sort="desc"
search:entry_id="{embed:entry_ids}" dynamic="off" limit="1" paginate="bottom"}
{exp:query limit="1" sql="select count(*) as recordcount from exp_channel_data a where entry_id IN ({embed:entry_ids}) AND channel_id=8"}
<b> {recordcount} </b> articles found for:<b> {embed:author_name} </b>
{/exp:query}
<br />
{exp:query limit="2" sql="Select B.field_id_29 as article_bodysubtitle,B.field_id_27 as bodytext, B.field_id_88 as iss_rel_id, D.title as articletitle, D.url_title as ut from exp_channel_data as B INNER JOIN exp_channel_titles D ON B.entry_id=D.entry_id where B.channel_id=8 AND B.entry_id IN({embed:entry_ids})"}
<br />
<strong>{articletitle}</strong>:
{exp:trunchtml chars="250" inline="..."}
{bodytext}
<br />
{/exp:trunchtml}
<br />
{embed="backissues/embed_iss" iss_rel_id="{iss_rel_id}"}
<br /><br />
{paginate}
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}
{/exp:query}
{/exp:channel:entries}

Your outer-most channel entries query is restricting the data set to return only one result.
Try changing the limit parameter:
{exp:channel:entries ... limit="2" paginate="bottom"}
When using pagination, the limit parameter determines the number of entries shown per page.

{exp:query limit="2" paginate="bottom" sql="Select B.field_id_29 as article_bodysubtitle,B.field_id_27 as bodytext, B.field_id_88 as iss_rel_id, D.title as articletitle, D.url_title as ut
from exp_channel_data as B
INNER JOIN exp_channel_titles D ON B.entry_id=D.entry_id
where B.channel_id=8
AND B.entry_id IN({embed:entry_ids})"}
{paginate}
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}
{exp:channel:entries channel="article" status="open" orderby="date" sort="desc"
search:entry_id="{embed:entry_ids}" dynamic="off" limit="1" }
<strong>{articletitle}</strong>:
{exp:trunchtml chars="250" inline="..."}
{bodytext}
<br />
{/exp:trunchtml}
<br />
{embed="backissues/embed_iss" iss_rel_id="{iss_rel_id}"}
<br /><br />
{/exp:channel:entries}
{/exp:query}

Related

Give a Style Class for Primefaces Generated span element

Primefaces password control generates a span element and an input text element when HTML is created. How can we give a class for such generated span element?
JSF Code
<p:password id="pwd"
toggleMask="true"
value="#{webUserController.password}"
class="form-control w-100" >
</p:password>
Generated HTML
<span class="ui-password ui-password-masked ui-inputwrapper ui-input-icon-right ui-inputwrapper-filled">
<input id="j_idt603:j_idt608:pwd" name="j_idt603:j_idt608:pwd" type="password" class="ui-inputfield ui-widget ui-state-default ui-corner-all form-control w-100 ui-state-filled" aria-disabled="false">
<i id="j_idt603:j_idt608:pwd_mask" class="ui-password-icon"></i>
</span>
How can I give a style class to the generated span element?
It looks like you are trying to get the field to be 100% wide. You could use PrimeFlex to do this by wrapping your p:password with <div class="field"> (p-field if you are on PrimeFlex 2), so:
<div class="field">
<p:outputLabel for="#next" .../>
<p:password .../>
</div>
See:
https://www.primefaces.org/primeflex/formlayout

How to open multiple component in p:inplace at once

i need to make all component editable when i clicked on h:commandLink
This my code
<p:dataTable styleClass="borderless" id="projectsTable" var="o" value="#{order.orderList}">
<p:column>
<div class="tasks">
<div class="task-item task-success">
<h:form>
<div class="task-text">
<div class="form-group">
<h:outputLabel for="projectName" value="Project Name:" />
<p:inplace effectSpeed="fast" editor="true">
<p:inputText styleClass="form-control" value="#{o.productName}" required="true" label="text" />
</p:inplace>
</div>
<div class="form-group">
<h:outputLabel for="projectURL" value="Project URL:" />
<p:inplace effectSpeed="fast" editor="true">
<p:inputText styleClass="form-control" value="#{o.price}" required="true" label="text" />
</p:inplace>
</div>
</div>
<div class="task-footer">
<div class="pull-left">
<h:commandLink >
<span class="glyphicon glyphicon-ok-circle" aria-hidden="true"></span> EDIT
</h:commandLink>
</div>
<div class="pull-right">
<h:commandLink action="#{order.deleteAction(o)}" >
<span class="glyphicon glyphicon-remove-circle" aria-hidden="true"></span> Delete
</h:commandLink>
</div>
</div>
</h:form>
</div>
</div>
that's link i need to click on it and open all h:inputText
<h:commandLink action="#{order.update(o)}">
<span class="glyphicon glyphicon-ok-circle" aria-hidden="true">
</span> EDIT
</h:commandLink>
Such as linkedIn in editProfile page when click on button appear all editable components
Examples:
Befor click button
After clicked button
First of all, every PrimeFaces component has a javascript representation which is acessible through the widgetVar.
The Inplace's widget has a method called show() that you can use to show the input field for it. Check this code out:
<p:inplace ... widgetVar="myinplace">
<p:inputText ... />
</p:inplace>
<!-- this button's click will show the input -->
<button onclick="myinplace.show()">Click Me</button>
I suggest you to set the widgetVar attribute for the inplace components and call the show method on each one of them inside a function that you can use everywhere you want:
<script>
function showInplaces() {
myinplace1.show();
myinplace2.show();
...
}
Cheers
During my lunchbreak I was curious, so I did have a quick look.
I looked at the generated source in the showcase of the first item:
<span id="j_idt88:basic" class="ui-inplace ui-hidden-container" data-widget="widget_j_idt88_basic">
<span id="j_idt88:basic_display" class="ui-inplace-display" style="display:inline">Edit Me</span>
<span id="j_idt88:basic_content" class="ui-inplace-content" style="display:none">
<input id="j_idt88:j_idt91" name="j_idt88:j_idt91" value="Edit Me" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" role="textbox" aria-disabled="false" aria-readonly="false" type="text" />
</span>
</span>
I noticed the class='ui-inplace-display' class which is on each 'component. The following jquery code selects all inplace components that can be clicked:
$('.ui-inplace-display')
I tried this in the FireFox developer console resulting in the following output:
Object { length: 5, prevObject: Object, context: HTMLDocument → inplace.xhtml, selector: ".ui-inplace-display", 5 more… }
I know you can enable the editing by clicking on an item and so I had to find a way to click on each one. Fortunately, you can give each of them a click by just appending .click() to the selector. It will be applied to each of the components:
$('.ui-inplace-display').click()
And like mentioned, you do not need any jsf button for this, just a plain html one to execute the javascript in an onlclick:
<input onclick="$('.ui-inplace-display').click()" value="Click to edit" type="button">
works perfectly.
As you can see, it pays to learn the basics of webdevelopment before diving into using more complex frameworks since no framework ever solves all of your problems and from time to time (more often then you think), you do need a little low-level javascript

I don't know how to get text from not close tag using beautifulSoup

<hr class="calibre2" />
<h3 class="calibre5">-ibility</h3> (in nouns 构成名词) : <br
class="calibre4" />
<blockquote class="calibre6"><p class="calibre_1"><span class="italic">◊
capability 能力 </span></p></blockquote>
<blockquote class="calibre6"><p class="calibre_1"><span class="italic">◊
responsibility 责任 </span></p></blockquote>
<hr class="calibre2" />
<h3 id="calibre_link-1" class="calibre5">-able</h3> □<span
class="bold"><span class="italic"><span class="calibre_2"> suffix</span>
</span></span> (in adjectives 构成形容词) <br class="calibre4" />
<span class="bold">『1』</span>that can or must be 可…的;能…的;应…的 :
<br class="calibre4" />
<blockquote class="calibre6"><p class="calibre_1"><span
class="italic">◊ calculable 能计算的 </span></p></blockquote>
<blockquote class="calibre6"><p class="calibre_1"><span
class="italic">◊ taxable 应纳税的 </span></p></blockquote>
<span class="bold">『2』</span>having the quality of 具有…性质的 : <br
class="calibre4" />
<span class="bold"><span class="calibre_3">-ability, -ibility </span>
</span>
<hr class="calibre2" />
<h3 class="calibre5">-ible</h3> □<span class="bold"><span
class="italic"><span class="calibre_2"> suffix</span></span></span> (in
adjectives 构成形容词) <br class="calibre4" />
<blockquote class="calibre6"><p class="calibre_1"><span
class="italic">◊ comfortable 舒适 </span></p></blockquote>
<blockquote class="calibre6"><p class="calibre_1"><span
class="italic">◊ changeable 易变 </span></p></blockquote>
<span class="bold"><span class="calibre_3">-ability, -ibility </span>
</span>
<hr class="calibre2" />
<h3 class="calibre5">-acy</h3> ⇒ <span class="bold">-cy</span>
<br class="calibre4" /> □<span class="bold"><span
class="italic"><span class="calibre_2"> suffix</span></span>
</span>
<blockquote class="calibre6"><p class="calibre_1"><span
class="italic">◊ chaplaincy 专职司铎的职位 </span></p></blockquote>
<hr class="calibre2" />
<h3 class="calibre5">-age</h3> □<span class="bold"><span
class="italic"><span class="calibre_2"> suffix</span></span></span>
(in nouns 构成名词) <br class="calibre4" />
Above code is I use Calibre to transfer from a English dictionary into html and then extract into html, but they they only add some none close tag, as you can see, between <hr class = 'calibre2'>... <hr class = 'calibre2'> content is I need, like: I want to get like: (word: meaning:), inside h3 is the words, and easily to get use beautifulsoup.findall('h3').text, and right now I know how to get between <hr>.. <hr> contents, but only contents, I don't know how to get only text. because <hr> is not a close tag, so I couldn't directly use tag.text to get.
So, I think maybe I could use wrap or new_tag, but seems not work for me maybe I misuse them, I want to add <div class= num> sth, between the 2 tag, so I could directly get it. and use tag.text to get them.
thank you.

Expression Engine list category entry only

With the code below, I am currently showing all the categories for the channel, but I only need to show the category or categories for each entry. They have been checkboxed in each seperate entry.
What am I missing?
{exp:channel:entries channel="news" dynamic="no" orderby="date" sort="desc" }
<article class="listing">
<h2>{title}</h2>
<p>Posted on: {entry_date format="%F %j, %Y"} in {exp:channel:categories channel="news" style="linear" show_empty="no"}
{category_name},{/exp:channel:categories}</p>
<p class="summary">{news_summary}</p>
<p style="margin-top: 10px;"><a href='{url_title_path='news/view'}'>Read More</a></p>
</article>
{/exp:channel:entries}
Problem was, I was using regular channel type tags for categories. The correct code for this is....
{exp:channel:entries channel="news" dynamic="no" orderby="date" sort="desc" }
<article class="listing">
<h2>{title}</h2>
<p>Posted on: {entry_date format="%F %j, %Y"} in
{categories backspace="1"}
{category_name},
{/categories}</p>
<p class="summary">{news_summary}</p>
<p style="margin-top: 10px;"><a href='{url_title_path='news/view'}'>Read More</a></p>
</article>
{/exp:channel:entries}

ExpressionEngine: Multiple channels issue with custom URL's

On this page:
http://build.jhousemedia3.com/pleasanton/shop/district-profile/stoneridge-shopping-center/
The URL is formatted like so
http://build.jhousemedia3.com/pleasanton/[channel]/[template]/[query parameter]
I'm running an exp:channel:entries query using the last segment of the URL (segment_4)
What's happening is that when I run it from this URL I can't pull in data from any other channel except the specific shopping districts channel. If I were to change that last segment to /?id=28 (or something similar) I can pull data from multiple channels.
Any ideas?
Code for pulling the profile of a shopping district based on the URL:
{exp:channel:entries url_title="{segment_4}" limit="1" channel="shopping_districts"}
<h2 class="upper"><span class="greenlight">{title}</span></h2>
{if center_website}
<div class="greyroundbox right"><a href="{center_website}" class="external-link" target='_blank'>Visit the Website</a></div>
{/if}
<p>{shopping_center_description}</p>
<div class="clear"></div>
{/exp:channel:entries}
Code for pulling in any business data
{exp:channel:entries channel="businesses"}
<li class="{switch='first|'}">
<p>
{business_name}
{categories_shopping}<br />
{if phone}
<strong>Phone</strong>: {phone}<br />
{/if}
<strong>Address</strong>: {address_1}<br />
{if address_2}
{address_2}<br />
{/if}
{city}, {state}, {zip}<br />
{if website}
<em>{website}</em>
{/if}
</p>
</li>
{/exp:channel:entries}
Maybe obvious, but have you added dynamic="no" to your other loop?
{exp:channel:entries channel="businesses" dynamic="no"}

Resources