-
Posts
90 -
Joined
-
Last visited
Everything posted by Alex
-
I have created a new user role, that role is not able to create thumbnail crops using the thumbnails module. When clicking 'Thumnails' it just opens a window with the home admin page. It works fine for the main superuser role. I tried allowing all permissions for the new role but no luck. Using processwire 2.1 - Alex
-
Thanks guys, nice to know about these little extra features. I will play with this over the weekend.
-
A quick question, what type of text field supports line breaks? I have a navigation list, I want to be able to break the text onto a second line where I choose. I have been using a textarea field then changing the Inputfield Type to TinyMCE. Is there a better way where I don't get all the tinyMCE formatting options? thanks Alex
-
Good to see another Australian. Nice work. (I'm also working through how to create a blog just now)
-
Yep, got it. Working fine now. Thanks!
-
Here's the navigation code: <?php $root = $pages->get("/"); $children = $root->children("limit=5"); $children->prepend($root); foreach($children as $child) { echo "<li><a href='{$child->url}'>{$child->title}</a></li>"; } ?>
-
thanks Apeisa & Pete, I see what you mean about using the same Page Array to match content, I had it sitting outside all that. i've got the pagination working by positioning the renderPager code as below, my only problem is that when I click to page 2, my main navigation still loses the 'Blog' and 'Info' pages... what would be causing that? <?php echo "<ul>"; $posts = $page->children("limit=3, template=blog-entry, sort=-date"); foreach($posts as $post){ foreach($post->image as $image) { $thumbnail = $image->size(460,0); echo "<li><a class='workImg' href='{$post->url}'><img class='photo' src='{$thumbnail->url}' alt='{$image->description}' /></a>"; } echo " <h2 class='blogTitle'><a href='{$post->url}'>{$post->title}</a></h2> "; echo " {$post->summary} <a class='readMore' href='{$post->url}'><strong>read more...</strong></a> <br /> <div class='vertLine'><p><strong>Date: </strong> {$post->date}</p></div> "; echo "<div class='vertLine2'>"; echo "<span><strong>Category: </strong></span>"; if ($post->categories){ foreach ( $post->categories as $category ) { echo '<a href="' . $category->url . '">' . $category->title . ' </a>'; } echo "</div>"; echo "<div class='dottyBlog'></div>"; } } $pagination = $posts->renderPager(); echo $pagination; echo "</li>"; echo "</ul>"; ?>
-
Okay its starting to make more sense to me now. To output those blog previews I did this: <?php echo "<ul>"; $posts = $page->children("limit=3, sort=-date"); foreach($posts as $post) { foreach($post->image as $image) { $thumbnail = $image->size(460,0); echo "<li><a class='workImg' href='{$post->url}'><img class='photo' src='{$thumbnail->url}' alt='{$image->description}' /></a>"; } echo " <h2 class='blogTitle'><a href='{$post->url}'>{$post->title}</a></h2> "; echo " {$post->summary} <a class='readMore' href='{$post->url}'><strong>read more...</strong></a> <br /> <div class='vertLine'><p><strong>Date: </strong> {$post->date}</p></div> "; echo "<div class='vertLine2'>"; echo "<span><strong>Category: </strong></span>"; if ($post->categories){ foreach ( $post->categories as $category ) { echo '<a href="' . $category->url . '">' . $category->title . ' </a>'; } echo "</div>"; echo "<div class='dottyBlog'></div>"; } } echo "</li>"; echo "</ul>"; ?> So i have amended my pagination code to be like your example: <?php $posts = $page->find("limit=10, template=blog-entry, sort=date"); foreach ($posts as $entry) { echo $entry->title; echo "<br />"; } $pagination = $posts->renderPager(); echo $pagination; It gives me a list of all the post titles, but no pagination links? I would prefer to just have the numbered links for the additional pages. http://www.hoof.net.au/pwire/blog/ thanks for quick replys by the way
-
I actually tried that one after reading a little about selectors, but my pagination has disappeared: http://www.hoof.net.au/pwire/blog/ I tried 2 alternatives: 'blog' (main blog page template) and 'blog-entry' (where the blog post has its own page) neither worked So at the moment my code is this: <?php $results = $pages->find("id>1, limit=10, template=blog-entry, sort=date"); $pagination = $results->renderPager(); echo $pagination; ?> I've allowed page numbers on the templates also.
-
Hi, I am including pagination on my blog page, its not quite working. I have 5 test posts in total, showing the first 3 posts on the main blog page. You can navigate to page 2 for the remaining 2 posts which works ok, but i'm losing my 'info' and 'about' pages in the main navigation which are children of the home page. Also the pagination links are showing 6 pages, which are empty after page 2. (too many pagination links) Here is the link to the blog page with pagination links at the bottom: http://www.hoof.net.au/pwire/blog/ This is the pagination code in on my blog page template: <?php $results = $pages->find("id>1, limit=10, sort=date"); $pagination = $results->renderPager(); echo $pagination; ?> I tried a few things after reading the pagination info page which mostly resulted in no pagination links at all. regards, Alex
-
great thank-you. As usual these things are easier than I thought.
- 14 replies
-
- root
- sub folder
-
(and 1 more)
Tagged with:
-
I have been building my site in a sub folder called 'pwire' Can I move the site to my root folder, what is the best way to do it? I had a search around the forums and main site but can't find a reference for this. I figure it might be the settings in index.php in the site folder? Alex
- 14 replies
-
- root
- sub folder
-
(and 1 more)
Tagged with:
-
Display categories and create list of category links
Alex replied to Alex's topic in Getting Started
thanks Diogo looks like a good one, I just ordered it.- 14 replies
-
- categories
- page field type
-
(and 1 more)
Tagged with:
-
Display categories and create list of category links
Alex replied to Alex's topic in Getting Started
Thanks Nico, it needed to move up inside that bracket - Alex- 14 replies
-
- categories
- page field type
-
(and 1 more)
Tagged with:
-
Display categories and create list of category links
Alex replied to Alex's topic in Getting Started
I read that too about typos in that book, maybe theres a new corrected edition I will check first. I'm trying to display the categories on my main parent blog page, attached to each blog post. I've tried something here and it displays the categories but only once at the bottom of the page. I know both posts have categories applied to them. I guess the code is not cycling through each post properly? also heres the page link to show what i mean: http://www.hoof.net.au/pwire/blog/ <?php echo "<ul>"; $posts = $page->children("limit=4, sort=-date"); foreach($posts as $post) { foreach($post->image as $image) { $thumbnail = $image->size(460,0); echo "<li><a class='workImg' href='{$post->url}'><img class='photo' src='{$thumbnail->url}' alt='{$image->description}' /></a>"; } echo " <h2 class='blogTitle'><a href='{$post->url}'>{$post->title}</a></h2> "; echo " {$post->body} <a href='{$post->url}'>read more...</a> <p><strong>Date:</strong> {$post->date}</p> "; } if ($post->categories){ foreach ( $post->categories as $category ) { echo '<a href="' . $category->url . '">' . $category->title . '</a>'; } } echo "</li>"; echo "</ul>"; ?>- 14 replies
-
- categories
- page field type
-
(and 1 more)
Tagged with:
-
Display categories and create list of category links
Alex replied to Alex's topic in Getting Started
i've got it working with your first method above, and thank-you for explaining it a bit more. Yeah I think 'Dummies' is appropriate, i'll check it out. I got turned off PHP when i was playing around with wordpress, but it seems much easier / logical with processwire to do what you want. I can see the different styles of code through my templates, so it will be good to focus on one style a bit more and become proficient with it. Anyway I seem to be able to solve a few of my own really basic problems as they come up, so i'm making a bit of progress. thanks Alex- 14 replies
-
- categories
- page field type
-
(and 1 more)
Tagged with:
-
Display categories and create list of category links
Alex replied to Alex's topic in Getting Started
Hi Diogo & Ryan, Both methods are great, the render method is good to know about, I have edited Diogo's with a bit of trial and error, to display a title, summary, small image that links to its post. <?php //find all the articles that have this category $articles = $pages->find("categories=$page"); //for each article found, print the fields you want foreach ($articles as $article) { echo "<a href='{$article->url}'>" . $article->title . "</a>"; //Display images if available if ($article->image) { foreach($article->image as $image) { $thumbnail = $image->size(300,0); echo "<div class='blogImg'><a class='workImg' href='{$article->url}'><img class='photo' src='{$thumbnail->url}' alt='{$image->description}' /></a>"; echo "<div class='blogDescript'>{$image->description}</div></div>"; //Display summary echo "<div class='body'>" . $article->summary ."</div>"; } } } ?> I'm also still having problems displaying the image on the main parent blog page which shows the latest posts. I adapted my template page from a 'news section' template example from a previous post, but i don't know how to code in the image between the 'date' and the 'body'. I tried a few variations but all ended in errors. This is my blog template: <?php include("./head.inc"); ?> <?php echo "<div id='content' class='grid_9'>"; ?> <h1><?=$page->title?></h1> <?php // start the blog posts list echo "<ul>"; // get the posts for this page $posts = $page->children("limit=4, sort=-date"); // note if you set the posts to sort by date descending on the /blog/ page // in the admin, then you can omit the "sort=-date" above. // cycle through each post and print it in a <li> foreach($posts as $post) { echo " <li><a href='{$post->url}'>{$post->title}</a> <p><strong>Date:</strong> {$post->date}</p> {$post->body} </li> "; } echo "</ul>"; // get values for our placemarker headline $start = $posts->getStart(); $end = $start + count($posts); $total = $posts->getTotal(); $num = $input->pageNum; $lastNum = ceil($total / $posts->getLimit()); // output the placemarker headline echo "<h4>Showing $start - $end of $total Article/s | Page $num of $lastNum</h4>"; echo "</div>"; include("./foot.inc"); Diogo, yes i'll have to get a starter's PHP book, sounds like some fun bedtime reading! will check out amazon. thanks - Alex- 14 replies
-
- categories
- page field type
-
(and 1 more)
Tagged with:
-
Display categories and create list of category links
Alex replied to Alex's topic in Getting Started
Hi Diogo, thanks - yes creating them as links is a better idea. I haven't created a categories template - thats my next task! Can the one template work for all the categories or do i need a template for each category? I guess it needs to cycle through each post that has that category applied to it perhaps?… i'm not sure if anyone can help that would be great. I'm at the point now where I'm working out that: <?php echo $page->title; ?> is the same as: <?=$page->title?> So my coding is a bit limited! But I feel like i am making progress.- 14 replies
-
- categories
- page field type
-
(and 1 more)
Tagged with:
-
Hi, I am creating a simple blog section, I want to display categories on each blog post. For the categories I have created a page (hidden) called 'Categories' and for each category a child page under this: On my blog-entry template I have added a page field type called 'categories' which allows me to select multiple categories from my parent page shown in the image above. Is this the right approach? Just having trouble displaying the categories on my blog-entry template: <?php /** * Blog Entry * */ include("./head.inc"); ?> <h1><?=$page->title?></h1> <p>Date:<?=$page->date?></p> <p>Category:<?=$page->categories?></p> <div id='bodycopy'> <?=$page->body?> </div> <?php echo $page->comments->render(); echo $page->comments->renderForm(); ?> <?php include("./foot.inc"); I have applied 2 categories to this blog post my categories are being listed as '1034|1033' so obviously my code is not right. heres a link which shows this: http://www.hoof.net.au/pwire/blog/blog-entry-1/ Also, how do i go about having a list of category links which display those blog posts, would it require a new page template like an 'archive' blog posts template. I'm not sure how to approach this. thanks, Alex
- 14 replies
-
- categories
- page field type
-
(and 1 more)
Tagged with:
-
I just read the latest post in the Modules/Plugins section about thumbnails not working in 2.2 so no need to answer my post above.
-
I can't see the thumbnail crop feature when I upload images, it was working fine previously. The only thing I can think of is that I upgraded to processwire 2.2?
-
Yes that worked straight away, thanks alot for explaining. Alex
-
I have installed the thumbnail cropping tool, edited my existing "images" field so it uses the fieldtype "CropImage" My crop setups are the default: thumbnail,100,100 This is working fine i can create cropped thumbnails, I just need some pointers on how use it on my template where I want to display the cropped thumbnail... This is the template code: <?php /** * Home template * */ include("./head.inc"); echo $page->body; echo "<ul id='portfolio_list'>"; $items = $pages->get('/portfolio/')->children("limit=6"); // Here we take children of portfolio page (limit=6) foreach($items as $item) { //Loop through them $image = $item->images->first(); $thumb = $image->size(100,100); echo "<li><a href='{$item->url}'><img src='{$thumb->url}' alt='{$thumb->description}'>"; echo "<br />{$item->title}<br />{$thumb->description}</a></li>"; } echo "</ul>"; include("./foot.inc"); Thanks Alex
-
Assigning pages to a Subnavigation, featuring those pages on homepage
Alex replied to Alex's topic in Getting Started
Thanks for all the help, all working well now. One more question before I stop this thread: Can I use the image thumbnail module on the thumbnails I have been displaying on my home page template, given they are coming from an 'images' field, or does it have to be an 'image' field to use that module? Alex -
Assigning pages to a Subnavigation, featuring those pages on homepage
Alex replied to Alex's topic in Getting Started
I'm not quite there yet, sorry this has been dragging on. I'm still getting an error on my home page where I am trying to display a thumbnail, title & description from my portfolio template: Call to a member function size() on a non-object (line 16 of /home/alexcree/public_html/cog/site/templates/home.php) It would be ideal to grab the first image from the images field which is on my portfolio template (attached screen grab) This is now my home template where i have tried using Ryans code for grabbing the first image from the images field... obviously i don't have it right yet: <?php /** * Home template * */ include("./head.inc"); echo $page->body; echo "<ul id='portfolio_list'>"; $items = $pages->get('/portfolio/')->children("limit=6"); // Here we take children of portfolio page (limit=6) foreach($items as $item) { //Loop through them $image = $page->images->first(); $thumb = $image->size(100,100); echo "<li><a href='{$item->url}'><img src='{$thumb->url}' alt='{$thumb->description}'>"; echo "{$item->title}<br />{$thumb->description}</a></li>"; } echo "</ul>"; include("./foot.inc"); Is it because my template code above is trying to call on an image field instead of an images field? Thanks Alex