Posts: 184
Threads: 20
Joined: Apr 2010
2012-04-03, 23:24:29
(This post was last modified: 2012-04-03, 23:39:03 by karentsui.)
I have images in the beginning of my pages which I want to show in their excerpts. I tried commenting out
$excerpt = htmlspecialchars_decode($excerpt);
in pages_exerpts.php
it worked on my localhost server but not online which showed the damaged image icon instead of the images.
How do I make the images appear in the excerpts?
[EDIT] Also, the text loses its formatting and line breaks. I want it to maintain its formatting.
Posts: 346
Threads: 27
Joined: Sep 2010
Doesn't using the built-in code do this:
Code: <?php get_page_excerpt($length, 'false'); ?>
Or are you talking about having excerpts in search results as opposed to displaying the excerpt on the beginning of the page itself?
Posts: 184
Threads: 20
Joined: Apr 2010
I have many child pages whose excerpts I want to display on the parent page. Ideally I would have used the News Manager if it supported categories because I need to do it for many parent pages.
There are images on the top of the child pages which I want to display in the excerpt on the parent page.
Posts: 346
Threads: 27
Joined: Sep 2010
Install I18N Search, then on your parent page put the following content in:
Code: (% searchresults tags="_parent_SLUG" numWords="Xp" %)
Replacing SLUG with the slug of the parent and X with the maximum number of paragraphs you want to display in your excerpt. This method maintains whatever formatting exists (so images are included; I've tested this) so long as it is within the X number of <p> tags you specified.
You can style the look of these search results either by creating a component specially for the page or using Special Pages and styling it from that plugin.
Hope this works for you!
Posts: 184
Threads: 20
Joined: Apr 2010
Angryboy Wrote:(% searchresults tags="_parent_SLUG" numWords="Xp" %)
I am getting "no results found."
Posts: 346
Threads: 27
Joined: Sep 2010
4 questions then: - What plugins do you have installed?
- What settings do you have for your parent page(s)?
- What is the navigational structure of your parent/child pages?
- What is the exact content that you have pasted onto the parent page(s)?
Posts: 184
Threads: 20
Joined: Apr 2010
List of plugins installed:
DynPages
FAQ
I18N Base
I18N Custom Fields
I18N Gallery
I18N Navigation
I18N Search
Innovation Theme Settings
News Manager
p01-contact
Excerpts
Sitemap
what setting do you have for the parent page?
Didn't quite understand this one.
What is the navigational structure of your parent/child pages?
parent page
- child page1
- child page2
- child page3
What is the exact content that you have pasted onto the parent page(s)?
(% searchresults tags="_parent_writeups" numWords="2p" %)
Posts: 346
Threads: 27
Joined: Sep 2010
2012-04-06, 05:37:24
(This post was last modified: 2012-04-06, 05:53:21 by logonsf.)
Thanks for giving me all this information. I've set up a fresh install of GetSimple with the latest versions of all of these plugins just to see what happens, but I still have not encountered this problem. By any chance, are you using the latest version of I18N Search (since the _parent_ functionality was added to the most recent update)?
Posts: 184
Threads: 20
Joined: Apr 2010
2012-04-06, 17:14:19
(This post was last modified: 2012-04-06, 17:23:39 by karentsui.)
Great. My search version was older. Now it works. How do I remove the words 'Search Results' and 'en' from the displayed results.
I understand I can remove the bullets through css styling. But I also need to remove the words 'search results' and 'en'.
[EDIT] Solved it through the following css.
ul.search-results {list-style:none;margin:0;padding:0;}
li.search-entry {clear:both;list-style:none;}
.search-header {display:none;}
.search-entry-language {display:none;}
Posts: 184
Threads: 20
Joined: Apr 2010
But now there is a new problem. With the page excerpts there was a 'more' link at the end of the text, letting viewers know that they need to click on a link to read more text. With the search results approach, there is nothing in the text to let the viewers know that there is more article to be viewed.
Posts: 2,094
Threads: 54
Joined: Jan 2011
andyash Wrote:How do I remove the words 'Search Results' and 'en' from the displayed results.
Code: (% searchresults tags="_parent_writeups" numWords="2p" HEADER="" showLanguage=0 %)
All parameters are listed in Plugins/Configure I18N Search/Usage.
You can also globally switch off showLanguage in Plugins/Configure I18n Search/Settings.
Posts: 346
Threads: 27
Joined: Sep 2010
2012-04-06, 17:41:30
(This post was last modified: 2012-04-06, 17:43:41 by logonsf.)
andyash Wrote:But now there is a new problem. With the page excerpts there was a 'more' link at the end of the text, letting viewers know that they need to click on a link to read more text. With the search results approach, there is nothing in the text to let the viewers know that there is more article to be viewed.
With custom rendering you can do this. Create a component and give it the following code:
Code: <h3 class="search-entry-title">
<?php if ($showLanguage) { ?>
<span class="search-entry-language">
<?php echo htmlspecialchars($item->language, ENT_NOQUOTES); ?>
</span>
<?php } ?>
<a href="<?php echo $item->link; ?>">
<?php echo htmlspecialchars($item->title, ENT_NOQUOTES); ?>
</a>
</h3>
<?php if ($showDate) { ?>
<div class="search-entry-date">
<?php echo strftime($dateFormat, $item->pubDate); ?>
</div>
<?php } ?>
<div class="search-entry-excerpt">
<?php echo $item->getExcerpt($item->content, $numWords); ?>
</div>
<div class="search-entry-more"><a href="<?php echo $item->link; ?>">...more</a></div>
Then within your (% %) brackets, paste
Code: component="COMPONENTSLUG"
With the component slug being the exact slug of the component you just defined (as a piece of advice, avoid having spaces and capital letters in your slug since that can introduce problems sometimes).
You can add virtually anything you want within the component to be displayed per-search-result. For example if you wanted to have a piece of information from a Customfield of yours, simply use:
<?php echo $item->fieldname; ?>
or
<?php echo htmlspecialchars($item->fieldname, ENT_NOQUOTES); ?>, depending on which one suits your needs. Have a fiddle around with the markup of your component until you've got what you are looking for.
Posts: 2,094
Threads: 54
Joined: Jan 2011
andyash Wrote:But now there is a new problem. With the page excerpts there was a 'more' link at the end of the text, letting viewers know that they need to click on a link to read more text. With the search results approach, there is nothing in the text to let the viewers know that there is more article to be viewed.
Using numWords="2pm" will add "..." (but no link - the user needs to click on the header of the item):
Code: (% searchresults tags="_parent_writeups" numWords="2pm" HEADER="" showLanguage=0 %)
Posts: 184
Threads: 20
Joined: Apr 2010
2012-04-06, 23:19:48
(This post was last modified: 2012-04-06, 23:55:52 by karentsui.)
Quote:(% searchresults tags="_parent_writeups" numWords="2pm" HEADER="" showLanguage=0 %)
not working.
Posts: 184
Threads: 20
Joined: Apr 2010
2012-04-07, 03:59:22
(This post was last modified: 2012-04-07, 04:00:03 by karentsui.)
Angryboy Wrote:With custom rendering you can do this. Create a component and give it the following code:
Code: <h3 class="search-entry-title">
<?php if ($showLanguage) { ?>
<span class="search-entry-language">
<?php echo htmlspecialchars($item->language, ENT_NOQUOTES); ?>
</span>
<?php } ?>
<a href="<?php echo $item->link; ?>">
<?php echo htmlspecialchars($item->title, ENT_NOQUOTES); ?>
</a>
</h3>
<?php if ($showDate) { ?>
<div class="search-entry-date">
<?php echo strftime($dateFormat, $item->pubDate); ?>
</div>
<?php } ?>
<div class="search-entry-excerpt">
<?php echo $item->getExcerpt($item->content, $numWords); ?>
</div>
<div class="search-entry-more"><a href="<?php echo $item->link; ?>">...more</a></div>
Then within your (% %) brackets, paste
Code: component="COMPONENTSLUG"
With the component slug being the exact slug of the component you just defined (as a piece of advice, avoid having spaces and capital letters in your slug since that can introduce problems sometimes).
You can add virtually anything you want within the component to be displayed per-search-result. For example if you wanted to have a piece of information from a Customfield of yours, simply use:
<?php echo $item->fieldname; ?>
or
<?php echo htmlspecialchars($item->fieldname, ENT_NOQUOTES); ?>, depending on which one suits your needs. Have a fiddle around with the markup of your component until you've got what you are looking for.
This worked well. Thanks.
Posts: 346
Threads: 27
Joined: Sep 2010
No problem *thumbs up* If you want to make any more changes to the displaying of your results but are unsure of how exactly, feel free to ask.
Posts: 184
Threads: 20
Joined: Apr 2010
|