Jump to content

Peter Knight

Members
  • Posts

    1,375
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by Peter Knight

  1. Martijn

    Thankyou - I have downloaded the pedigree profile and am looking at the .inc

    Unfortunately, it's way beyond my level of PHP understanding. Although I have a sense of what it's doing, I couldn't confidently tweak it to my own requirements.

    Mainly I'd like to combine this 

    <div class="row">
    <ul class='topnav'>
    		<?php foreach ($pages->get(1)->Top_Navigation->find() as $topnav){echo "
            <li><a href='{$topnav->url}'>{$topnav->title}</li>
    		";
    	} ?>
    </ul>
    </div>
    

    with MarkupSimpleNavigation but I cam not sure how to pass $topnav array to MarkupSimpleNavigation or vice versa.

  2. Sure, since you can define the rootPage: 

    I guess what I meant was slightly different?

    I made a simple top navigation bar on my site. It's a global navigation bar beside the logo.

    But I'm restricting the pages that appear here to 6 or 7 pages which my client chooses via the page fieldtype (called "Top_Navigation".

    <div class="row">
    <ul class='topnav'>
    	<?php foreach ($pages->get(1)->Top_Navigation->find() as $topnav){echo "
            <li><a href='{$topnav->url}'>{$topnav->title}</li>
    		";
    	} ?>
    </ul>
    </div>
    

    I was wondering how I could combine the above with 

    	<?php 
    	$treeMenu = $modules->get("MarkupSimpleNavigation"); // load the module
    	echo $treeMenu->render(); // render default menu
    	?>
    

    allowing me to inject some classes into my list etc and specify active classes etc etc.

  3. I have this working now with the three columns I want  :).

    I basically select the three pages from a page field on the homepage called "Featured_Content". Each of those pages has a title, image and summary.

    <div class="layer layer-is-featured">
          <div class="row">
          
    <?php foreach ($pages->get(1)->Featured_Content->find('limit=3') as $featured){echo "
            <div class='small-12 medium-4 columns'>
               <img src={$featured->images->first()->url} />
               <h3 class='feature-heading'>{$featured->title}</h3>
                 {$featured->summary}
                 <a href='#'>Read more</a>
            </div>
    ";} ?>
          </div>
    </div>
    
    I'm wondering what the best way to crop each featured image to a specified dimension would be.
     
    If I ask my client to ensure each image is 330 x 158, she's going to mess this up.
     
    This looks like it might be my solution (http://modules.processwire.com/modules/fieldtype-crop-image/) but I'd rather specify in the code that each image should be cropped to 330 / 158.
     
    I have read through the ProcessWire image API docs (http://processwire.com/api/fieldtypes/images/) but I'm not sure how to combine this with my code above.
     
    foreach($page->images as $image) {
     $large = $image->width(500); 
     $thumb = $image->size(100, 100); 
     echo "<a href='$large->url'><img src='$thumb->url'></a>";
    }
    
    • Like 1
  4. Actually, I think I just found the answer to my questions apart from number 2

    1. Retain the "Add New" button on the top right of my Admin screen with just "Add new blog post" appearing.

    I found some Access settings for the Blog template and this enabled this.

     

    2. Restrict her view of the site tree to just the Blog and child pages

    No idea how to do this

     

    3. All her to edit any pages under the blog parent

    Access setting for that particular template.

  5. Hi guys

    I have a tiny PW site with a blog and want to give my client admin access create and edit her own posts, moderate comments etc.

    I've already set her up as a User, assigned her a role of "blog-author" with permissions of:

    • View pages
    • Edit pages
    • View Blog page
    • User can update profile/password

    However, when I log in as her I am wondering how I could achieve following within the admin IE Not hard-coding or PHP-ing? 

    1. Retain the "Add New" button on the top right of my Admin screen with just "Add new blog post" appearing.

    2. Restrict her view of the site tree to just the Blog and child pages

    3. All her to edit any pages under the blog parent

    Particularly confused as to why no. 3 is not working as her role of "blog-author" has "edit-pages" ticked. 

  6. Nico 

    Youre right of course - I could always use a very long template name.

    I just tried your example and wierdly enough, when I hit submit PW tried to create a separate template for every word in the template title.

    So not I have templates called

    a

    automatically

    Gallery

    generate

    template

    this

    to

    use

    -

    Wierd !

  7. When creating or adding a new template I'd like a short template description field.

    That template description should then also be visible when choosing a template for a page.

    If you've a lot of templates, it gives editors some asseurance that the template they are selecting is the correct one.

  8. Cheers. Looks pretty comprehensive and I've got the printer working it's way through it.

    Could you point me in the direction of how to output fields from my selected pages?

    I've created a page field, added it to my template and then on my actual page, I have selected my 3 pages. That was all remarkably straighforward. But how do I get the field values I want out onto a different page?

    foreach ($page->pattern_type as $pt) {
    echo $pt->title;
    echo $pt->featured-image;
    echo $pt->featured-summary;
    } 

    Should I replace "pattern_type" as my Pages Field name?

  9. Thanks diogo

    There's just too many ways to do this in PW. Guess thats the beauty of it! :)

    1. Add a "featured" checkbox to each page and show the last 3: $pages->find('featured=1, sort=-date, limit=3');   

    That would certainly work. Would my client be able to reorder the sequence of featured items though? They could be from very disparate areas of the site.

    2. Add a page field in the homepage where your client can add pages, and show the top 3 from that field.

    Thank you for introudcing me to the page field! I hadn't seen it before and watching this, I can't believe how simple and powerful it will be for my client.

    I've purchased ProFields anyway but I'm sure I'll find a use for it :)

  10. Hi 

    I have an area on every page of my site which includes 3 columns of "featured" content as determined by my client.

    Each feature consists of:

    • A page title (and link to parent page)
    • An image
    • Small paragraph of summary text

    post-1166-0-97381500-1407854804_thumb.pn

    I know that I must add these fields to my pages and then populate them with content. The part i'm stuck at is how best to let client my determine which 3 pages get featured. I think number 3 here is the best way but wanted to ask more seasoned users their approach.

    Should I ...

    1. Create some mechanism for a client to specify a page as "featured" thereby triggering inclusion into a footer. I'd have some API call scanning pages for a checked "featured" checkbox etc

    or

    2. Create 3 small sub-pages elsewhere on the site consisting solely of the title,image,paragraph fields. I could place them in some kind of sub-folder called "featured". My client would be told to only ever have 3 sub pages and they could edit, rearrange etc

    or

    3. Create a single page called "Featured" consistign of the new ProField Table whereby client can order and reorder as they wish. That ProField Table would be a row consisting of "Title", "Image" and "Summary".

  11. Love Phillips work on the theme with the split tree/editing

    Having used Silverstripe and MODX, split screen editing is much better IMHO.

    As a new comer to PW, I appreciate that there's a simplicity in displaying only the tree but I'd love to see this as an option. 

    • Like 1
  12. Guys - thanks for all your help. 

    I did a reboot of MAMP, rebooted my Mac and did a fresh install of PW and it's working now.

    Appreciate all the help though.

    I always set up virtual hosts for every project or test install i do. This way the default .htaccess has never failed me and it saves headaches when deploying to live domains.  

    What are the benefits of a virtual host when developing locally? And whats the difference between running on MAMP or some localhost?

  13. Are you developing on Windows?

    What LAMP server are you using?

    I do all my development locally. I have at least five separate ProcessWire installations on my Windows 7 desktop.

    MAMP 3.05 running on Mac OSX Mavericks

    Might fire up the other Mac and see if I have the same issue and try one of the Windows machines too.

  14. My mistake - I *can* edit the htaccess file and have uncommented the appropriate line

    RewriteBase /

    So right now I am getting the error as follows. 

    • Not Found
      The requested URL /index.php was not found on this server.

    I presume there should be an index.php file in the root of /processwire ?

  15. Cheers adrian. Understood. I've reverted the folder name back to the original name.

    Re the URL you supplied, I can confirm that mod_rewrite is working. Unfortunately I can't make any htaccess chaneges this is a local install. 

    Thanks for the help. I'll perform a remote install.

  16. I think you are mixing things up.  The PW directories are /site and /wire.   The /processwire url in the setup script is for admin access purposes.  They are not the same thing.

    Ok, fair enough - thanks for clarifying.

    Same issue though. Installation says I should visit /processwire/ to access the admin but browsing to this gives me a 404 on a local install.

  17. I did a reinstall with a new database and left the Admin Login URL on the setup screen as "processwire".

    After successful installation, I was given the new URL of /processwire/

    Looking at my local files, the default folder called "wire" is still "wire" so I'm not suprised to get a 404 error.

    Renaming that folder to "processwire" throws the original "forbidden" error.

    I think I'll just install remotely for the moment or try the stable branch  :)

  18. No joy. I located the appropriate the table and indeed it was set to "wire" but changing it to "processwire" or "admin" has no result when I used that new directory within the URL.

    Thanks anyway


    Interesting bu the admin url is by "wire" by default when I unzip the latest gihub build

  19. Hi guys

    I'm attempting to install PW locally for the first time.

    I've created and connected to the database but when I visit my admin/manager URL, I get the following error

    http://localhost:8888/procewsswire-test/wire/

    Forbidden
    You don't have permission to access /processwire-test/wire/ on this server.

    The actual demo site is showing fine with the minimal site profile. This is a download from the dev branch of github.

    Just wondering is it a folders permission? I don't think I can CHMOD locally?

  20. Cheers for the reply and apologies re the framework mixup.

    I guess I'm approaching this with a few expectations picked up from my other blogging platform. Within that, almost every part of the blog was a mini template which you could tweak to make fundamental layout changes.

  21. Hmm. I think I see whats happening. Youre basically saying "for each page that uses blog-post as a template, output X".
     
    I just realised my output isn't creating a new row for each blog post so I modified it to be as follows.

    <!-- START Nested Column containing featureimage and post-summary --> <?php $blogposts = $pages->find("template=blog-post"); foreach ($pages->find("template=blog-post") as $b) {
     
    echo "
      <div class='row'>
        <div class='small-12 large-6 columns'><img src={$b->blog_images->first()->url} /></div>
        <div class='small-12 large-6 columns'><p>{$b->title}</p><p>{$b->blog_summary}</p></div>
      </div>
    ";
    } ?>
    
                    <!-- END Nested Column containing featureimage and post-summary -->
    
    • Like 1
×
×
  • Create New...