flydev

Bootstrap 4 Minimal site profile

Recommended Posts

Bootstrap-4 Minimal site profile for ProcessWire

This profile is based on the "minimal site profile (intermediate edition)" and bundled with Boostrap v4.0.0-alpha.2.

The precompiled version can be downloaded at github.

 

  Features

  • Bootstrap SASS
  • Font-Awesome SASS
  • MeanMenu
  • Render / helper functions for :
    • Simple ul navigation
    • Bootstrap Multi-level navbar
    • MeanMenu Responsive menu for mobile device
    • Bootstrap Carousel
    • Bootstrap Cards

  Dependencies

  • jQuery
  • Tether (Tooltips and Popovers)

  Prequisites

 You'll want to install the following on your system before proceeding:

How To Install

  1. Download the zip file at Github or clone directly the repo with git clone and skip the step 2.
  2. Extract the folder site-pwbs4-master into a fresh ProcessWire installation root folder.
  3. During the installation of ProcessWire, choose the profile "ProcessWire Bootstrap 4 profile".

  After installation

The last step is to install all assets and dependencies with Bower.

  • Open a terminal in site/templates and execute the following command-line: bower install

  References

  Credits

  • The ProcessWire staff
  • Inspiration from @gebeer and his Bootstrap 3 profile post
  • Members who contributed in various post about Bootstrap navigation and code (see code-source for refs).

Screenshots

Capture.PNGCapture-responsive.PNG

  • Like 11

Share this post


Link to post
Share on other sites

It is currently only compatible with the devns branch.  Give me some minutes to make backward compatibilty :-X .

It is now compatible with ProcessWire-2.7.

  • Like 4

Share this post


Link to post
Share on other sites

Thanks for doing this and will start working with this one this week-end. Really excited about it if this one can release me from using Pocketgrid all the time. Did you know that there is a thread about templates for Processwire ?

https://processwire.com/talk/topic/12892-processwire-marketplace/

This bootstrap profile could be a very good one to start with.

  • Like 2

Share this post


Link to post
Share on other sites

@pwired :   I will send an email to @kongondo about processwireshop.pw! Thanks for suggesting that.

----

A small trick to make the navbar/dropdown working on mouseover instead of click event:

In js/script.js add :

$(document).ready(function(){
    $('ul.nav li.dropdown').hover(function() {
        $(this).find('.dropdown-menu').first().stop(true, true).delay(200).fadeIn(200);
    }, function() {
        $(this).find('.dropdown-menu').first().stop(true, true).delay(200).fadeOut(200);
    });
});
  • Like 2

Share this post


Link to post
Share on other sites

Is there anything that has to be compiled before using this template ? For example until now I only use plane css and not sass also never used "bower-install" Maybe there is a pre-compiled version ?

Share this post


Link to post
Share on other sites

In the current state of the profile, Bootstrap is already precompiled in css/styles.css; You can also find in the folder css a file called main.css where you can override all values and use it as pure css - without the need of using sass and associated tools - but at this point  you still need Bower.

Bower is used to manage assets like font-awesome and a dependency like tether in our case. With this tool we can manage libs easily and we can avoid repeating tasks. It is really easy to install and do not require any knowledge for the task we accomplish here. If you want to get started with, check the following instructions :

  1. goto https://nodejs.org/ ,  download / install NodeJS
  2. install Git (if you're on Windows, be sure to check Run Git from command-prompt)
  3. open a terminal and type npm install -g bower

done.

You can now execute the bower install command-line.

 

Anyway, if its really required, I can make tonight a profile with precompiled files so you can test it this week-end :). Just let me know.

 

  • Like 1

Share this post


Link to post
Share on other sites


Hi @flydev,
Thanks for stepping in on this. I am not yet familiar with node and git and use processwire with plane php, api, css and pocketgrid. So Yes I would appreciate it for making a profile with precompiled files to enable me start using your template. Thanks in advance.

Share this post


Link to post
Share on other sites

I have setup an online test server and uploaded/installed the pre-compiled profile (template) inside a processwire 2.7.2 setup. It looks everything is working well and also nicely responsive. I find this great. I am going to have a look in the back and front end and see how I can change it into some website and learn bootstrap and tether. You can see the online setup here: http://dev9.pe.hu

 

  • Like 3

Share this post


Link to post
Share on other sites

Thanks you for trying this profile.

I just pushed an update to the css for the responsive menu. Just remove the following code in main.css.

Spoiler

/* meanmenu adjustment (see body: line-height) */
.mean-nav ul li {
    line-height: 24px;
}
.mean-container .mean-nav ul li a.mean-expand {
    height: 24px;
}

 

 

  • Like 3

Share this post


Link to post
Share on other sites

@flydev Thanks a lot for putting this together. I was only waiting for BS4 to reach beta state before I will update my site-pwbs profile. Now I don't need to spend the time on it myself, which is great :)

@pwired @cstevensjr

I can only recommend to preprocess yourself and encourage you to look into node, compass, bower etc. It really is worth the effort and gives you so much more flexibility. With the precompiled version of this profile, you need to override a lot of stuff in your own CSS and this will bloat your code.

  • Like 3

Share this post


Link to post
Share on other sites
9 minutes ago, gebeer said:v

@pwired @cstevensjr

I can only recommend to preprocess yourself and encourage you to look into node, compass, bower etc. It really is worth the effort and gives you so much more flexibility. With the precompiled version of this profile, you need to override a lot of stuff in your own CSS and this will bloat your code.

While I agree with you that one needs to expand their horizons, we also need to understand that not everyone uses the latest technology.  We should strive to make these profiles accessible to everyone, no matter their knowledge/skill level.

My push will always be about accessibility to technology by all.  I firmly believe that's how things will spread.

  • Like 3

Share this post


Link to post
Share on other sites

@cstevensjr I partly agree with you. And again thanks to @flydev for providing the precompiled version. But in a way this defeats the purpose of a sass based site profile.

Share this post


Link to post
Share on other sites
Just now, gebeer said:

@cstevensjr I partly agree with you. And again thanks to @flydev for providing the precompiled version. But in a way this defeats the purpose of a sass based site profile.

You seem to be stuck on sass and I am talking about having PW profiles that a basic beginner (who may or may not know anything about sass) can utilize.  We are coming together from two totally different planes.  Yes, I believe it was fantastic and a good trend that @flydev augmented the profiles by including the precompiled version.  It should be a great learning tool for all.

  • Like 4

Share this post


Link to post
Share on other sites

@cstevensjr Got your point and totally agree with what you're saying. I didn't mean to force anybody into using preprocessors. Just wanted to encourage people to start looking into it because it really can make live easier...

  • Like 4

Share this post


Link to post
Share on other sites

Thank you Flydev. I've spent several days looking for proper solution to the PW BS3 dropdown menu issue. And then today I've found this. This profile will be my based from now onward. So far it works good, looking forward to build something great out of this. Once again TQVM.   

  • Like 4

Share this post


Link to post
Share on other sites

Hi @kibod ,  glad you like it and choose it as project starter.

And yes in this profile you can have the first parent as menu, clickable.

  • Like 3

Share this post


Link to post
Share on other sites

Hi @flydev, I plan to use your profile for my next project. I've installed it and it works fine. The carousel however just has only images and no corresponding heading and links, for that would really make the carousel experience complete. Is there a way to add heading and link to the images? Thanks.

Share this post


Link to post
Share on other sites

Hi @MaryMatlow

15 hours ago, MaryMatlow said:

I've installed it and it works fine.

Can you please tell me the version of ProcessWire ?

 

15 hours ago, MaryMatlow said:

Is there a way to add heading and link to the images?

Yes, you have to copy and/or modify the function bsRenderCarousel();

For instance, you could use a repeater to pass datas to the function. Let's say we create a repeater with the three following fields: image_carousel, heading, heading_description

Capture.PNG

and insert the repeater with the name 'carousel' in the home template.

 

In _func.php, add this function :

Spoiler

function bsRenderCarouselFromArray(array $datas) {

    $cnt = count($datas['images']);
    $id = $datas['images'][0]->get('page').$datas['images'][0]->get('field')->id;
    $out  = "<div id='carousel-{$id}' class='carousel slide' data-ride='carousel'>
                <ol class='carousel-indicators hidden-sm-down'>";
    $i = 0;
    foreach($datas as $image) {
        $class = ($i == 0) ? "active" : "";
        $out .= "<li data-target='#carousel-{$id}' data-slide-to='{$i}' class='{$class}'></li>";
        $i++;
        if($i >= $cnt) break;
    }
    $out .= "</ol>
             <div class='carousel-inner' role='listbox'>";
    $i = 0;

    foreach($datas as $data) {
        $class = ($i == 0) ? "active" : "";
        $out .= "<div class='carousel-item $class'>
                <img src='{$datas['images'][$i]->url}' alt='{$datas['images'][$i]->description}' height='{$datas['images'][$i]->height}' width='{$datas['images'][$i]->width}'>
                <div class='carousel-caption'>
                    <h3>{$datas['headings'][$i]}</h3>
                    <p>{$datas['description'][$i]}</p>
                </div>
             </div>";
        $i++;
        if($i >= $cnt) break;
    }
    $out .= "</div>";
    $out .= "<a class='left carousel-control' href='#carousel-{$id}' role='button' data-slide='prev'>
                <span class='icon-prev' aria-hidden='true'></span>
                <span class='sr-only'>Previous</span>
             </a>
             <a class='right carousel-control' href='#carousel-{$id}' role='button' data-slide='next'>
                <span class='icon-next fa fa-chevron-right ' aria-hidden='true'></span>
                <span class='sr-only'>Next</span>
            </a>
        </div>";

    return $out;
}

a bit hacky but eh...

 

Then in the home template, make the array and call the new function with the new array as parameter :

// render the carousel
//$content .= bsRenderCarousel($page->images);
foreach ($page->carousel as $key => $value) {
    $datas['images'][] = $value->carousel_image;
    $datas['headings'][] = $value->heading;
    $datas['description'][] = $value->heading_description;
}

$content .= bsRenderCarouselFromArray($datas);

 

Result:

pwbs4.gif

 

 

  • Like 4

Share this post


Link to post
Share on other sites

Hi @flydev, It works like a charm :-). Thank you, thank you. The only other thing i needed was a link/button to link the slide to another page/post. I'll try to do that myself first. If I get stuck will ask for your help. Thank you very much.

  • Like 1

Share this post


Link to post
Share on other sites

Hi all!

I have ProcessWire 3.0.42 installed with a lot of content. How can I install this bootstrap profile over it?

Cheers

Fred

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By karian
      Hi, based on the work of @microcipcip and @gebeer  (see their posts here and here), I put together a Processwire + React boilerplate (profile).
      Github repo: https://github.com/lapico/process-react

      Cheers,
      K
       
    • By webhoes
      Hello,
      I am working of a site for a sport organisation.
      All affiliated gyms can edit their profile. I have used the advaced mode so that if you create a new page under location the gym can login and edit their profile.
      i also want that they can add instructors as child of their profile and also are able to edit those instructors.
      I can not get passed the able to edit all subpaged or none.
      How should this be done? Or is this not possible?
    • By ethanbeyer
      Hello,
      I recently posted in this topic, but I decided to start my own thread because while I believe my issue is related to the one in that thread, they are not exactly the same:
       
      I have created a custom User Template in the method outlined in the docs. I am creating a directory, so it made sense that every page in the directory was a Directory Member, so they could log in and edit their own information while also keeping the entire directory protected behind a login wall.
      So the new user type is created: "directory-member".
      I then created two new roles: "member" and "directory-admin":
      The "member" only has the ability to View directory-member pages, and "profile-edit", which allows them to manage their own information. The "directory-admin" has the ability to edit any directory-member pages, and administer users. Some Directory Members are both, but all have at least the "member" role.
      The first hint that something was wrong was when I was testing a "member" user and I could not add a new item to a repeater on that profile. The url for the profile edit (this will be important shortly) is site.dev/admin/profile. The repeater is set up to load new items through AJAX. If this option is turned off, the rest of this issue is no longer completely valid. But as I have found what I believe to be a pretty large issue in the Processwire codebase, I thought it worth bringing up.
      See, every page (even a user) has a $page->editUrl() method, and it returns a URL like this: site.dev/admin/access/users/edit/?id=2096. That's all good and fine for users that have page-edit permissions, but if they don't, that link will resolve to the admin's equivalent of a 404.
      So the way that Processwire currently gets around this is by creating a specific editing area for a user to interact with only their profile: /admin/profile. And that works pretty nicely, except for the fact that nowhere is editUrl() ever made aware of the difference. editUrl() is not hookable, and whether or not a page is editable is based on the PagePermissions module.
      On top of that, there are several core modules that hardcode a search-and-replace (see InputfieldRepeater.module:627) where the editing screen is for Users. This doesn't allow for a huge degree of flexibility that is offered in other places throughout Processwire. If line 627 of InputfieldRepeater is changed from this:
      $editorUrl = str_replace('/access/users/edit/', '/page/edit/', $editorUrl); to this:
      $editorUrl = str_replace('/access/users/edit/', '/profile/', $editorUrl); ...the AJAX repeaters work. It's maddening!
      As is brought up in the thread I attached above, a lot of the features of page editing are missing within /admin/profile/, and it just makes for an altogether strange editing experience. A user who has "page-edit" permissions for templates other than directory-member, but does have "profile-edit" permissions, will see their user in the Page List, but cannot edit their Page unless they hover over the wrench and click the "Profile" link. It just seems - off.
      I think what this hinges on for me is that the editUrl() of the user should be "/admin/profile/" if that user is logged in (and their page should be editable from the Page List), or the "/admin/access/users/edit/" url; regardless of the URL, both links should resolve to the Page Edit screen, as the Profile Edit screen seems to be a unnecessarily neutered version of Page Edit.
    • By modifiedcontent
      I have one central website, with membership registration and content etc., and then several related websites with their own URL/domains, each on Processwire, all on the same server.
      I would like to access the database of the central website from the sister websites. How would I do that?
      You can't bootstrap one PW installation into another. You can include template parts from one in the other by just using the server path, but whatever you try to get/post just comes/goes to the database of the site you are on.
      Could you switch databases by including the config.php from another PW installation somewhere?
      What is the correct, secure way to do this?
    • By Clément Lambelet
      Hi all,
       
      I'm really new to ProcessWire, maybe I missed the solution in the documentation.
      I'm working on a site which involves a lot of image upload fields, and I'm always getting many timeout errors. I'm pretty sure it's because I generate too many variations on a single page load (around 20 images with 7 different sizes, for them to be responsive).
      I can't use ImageSizerEngineIMagick to help (my host doesn't support it).
       
      I was wondering if there was a way to hook to the process of client-side image resizing (https://processwire.com/blog/posts/processwire-3.0.63-adds-client-side-image-resizing/) to generate the different variations (as it seems really faster). If not, is there a way to generate the different variations on upload and not on page load ?
       
      Any ideas and suggestions are welcome!