Posts: 54
Threads: 3
Joined: Nov 2010
I need advice on how to aproach programing for a simple Category -> Product/Service website
I am a medium level experience PHP programmer.
End pls excuse my english.
I need to create a simple website with a few main pages (top level pages) and subpages for them.
Something like Category (top level page) -> Products or Services (sub pages)
In the top level page I need to display a list of the subpages in a fashionable way, each list item having:
1. Thumbnail for the subpage (product or service)
2. Title of subpage
2. Excerpt of the subpage
3. Read more link
The subpage will be a regular second level page.
I thought I would use the i8n Custom fields Plugin to define the thumbnail path, and excerpt for each subpage
How would you aproach this?
Where to place the code? in functions.php of template?
Make a plugin ?
I am sure this would be useful for many purposes.
Posts: 54
Threads: 3
Joined: Nov 2010
tazmandev Wrote:I thought I would use the i8n Custom fields Plugin to define the thumbnail path, and e
Seems like no-one is willing to share some experience on this topic ...
Posts: 524
Threads: 48
Joined: Mar 2011
tazmandev Wrote:Seems like no-one is willing to share some experience on this topic ...
Sometimes posts get overlooked and bumping it occasionally can do wonders.
tazmandev Wrote:I am sure this would be useful for many purposes.
I totally agree with you there, I might even have a use for something like this myself in an up-coming project.
I saw your first post, but couldn't really come up with a good approach... sadly, I'm not a good programmer.
Posts: 1,921
Threads: 87
Joined: Apr 2010
Posts: 2,094
Threads: 54
Joined: Jan 2011
tazmandev Wrote:I need to create a simple website with a few main pages (top level pages) and subpages for them.
Something like Category (top level page) -> Products or Services (sub pages)
In the top level page I need to display a list of the subpages in a fashionable way, each list item having:
1. Thumbnail for the subpage (product or service)
2. Title of subpage
2. Excerpt of the subpage
3. Read more link
The subpage will be a regular second level page.
Possible solution with plugins I18N, I18N Custom Fields, I18N Search and DynPages:
- Use the I18N Custom Fields plugin for thumbnail (image field) and excerpt (text or WYSIWYG field)
- Create each top level page and put {% search category %} on it (category different for each top page - component search see below - uses DynPages)
- Create the subpages with parent = top level page, tags = category and a slug name which can be sorted in the order you want the products to be sorted. Use a template product.php (see below)
- Create a template product.php which displays the product image (using I18N Custom Fields) and the content of the page instead of the content only
- Create a component search which gets the argument (the category), uses return_i18n_search_results (I18N Search) to get all products for this category sorted by url and then displays the results in a custom way with image and excerpt - involves reading the page XMLs to get this information.
- Use I18N plugin to display the navigation
Steps 2+5 will be greatly simplified with the next major version of the I18N Search plugin.
Posts: 290
Threads: 26
Joined: Oct 2010
2011-06-08, 11:54:39
(This post was last modified: 2011-06-08, 11:56:39 by Chastin3.)
tazmandev Wrote:I need to create a simple website with a few main pages (top level pages) and subpages for them.
Something like Category (top level page) -> Products or Services (sub pages)
In the top level page I need to display a list of the subpages in a fashionable way, each list item having:
1. Thumbnail for the subpage (product or service)
2. Title of subpage
2. Excerpt of the subpage
3. Read more link
The subpage will be a regular second level page.
I think that is almost what I am doing on my site at this page:
http://www.cartocopia.com/portfolio/
I'm using Mike's Page Caching plugin:
http://get-simple.info/extend/plugin/page-caching/65/
Then in that portfollio page I have the following (simplified for you) code in my template (for that page):
Code:
/* Uses Mike's page caching plugin http://get-simple.info/extend/plugin/page-caching/65/ */
$childlist = getChildren(return_page_slug());
$subpagelist = array();
foreach($childlist as $child) {
if (returnPageField($child, 'private') != 'Y')
$subpagelist[] = array($child, returnPageField($child,'title'), returnPageField($child,'menuOrder'));
}
/* sort children my menuorder subval_sort is built in to GS2.1+ */
$subpagelist = subval_sort($subpagelist ,2);
foreach($subpagelist as $subpage) {
$thumb = '/data/uploads/' . $subpage[0] . '_thumb.jpg';
$link = $subpage[0] . '/';
$title = $subpage[1];
echo .....................;
}
So by making the thumbnails <slug>_thumb.jpg you can grab their reference, then on the echo line just build your image, title and link.
Add on the page excerpt plugin (as suggested by Oleg)
http://get-simple.info/extend/plugin/pages-excerpts/62/ and you can also grab an excerpt (200 chars, text format by default) in the loop with something like:
Code:
$snippet = page_excerpt($subpage[0]);
then also echo it out.
Good luck-
-Rob A>
Posts: 1,921
Threads: 87
Joined: Apr 2010
Posts: 54
Threads: 3
Joined: Nov 2010
Now I am overwhelmed with solutions. I will look at every one of them this afternoon. Thank a lot.