ryan Posted January 5, 2013 Share Posted January 5, 2013 ProcessWire Skyscrapers Site Profile This is the profile for the skyscrapers demo site as seen at: http://processwire.com/skyscrapers/. This site profile release also coincides with some upgrades to the Skyscrapers site. The updates were to re-do many of the template files to make them easier to read, convert some classes to functions (easier for folks to understand), and convert the maps to use the FieldtypeMapMarker module. The main differences from the live site are that this profile excludes most of the photos and skyscraper text. Only the photos taken by me are included. This is to ensure we aren’t distributing any text or photos in case the license ever changes to something other than Wikimedia Commons. I can change the text/photos on my skyscrapers site, but can’t on any sites someone else sets up with this profile, so figure it’s better to play it safe. Requirements ProcessWire 2.3 OR ProcessWire 2.2 dev branch (2.2.12 or newer) ZIP How to install Get the latest version of ProcessWire 2.3. At the time this text was written, ProcessWire 2.3 wasn’t yet released, so if that is still the case you’ll want to get version 2.2.12 or newer from the dev branch. Before running the installer, replace all the files/directories in the /site-default/ directory of ProcessWire with those from this site profile. This includes the following:/site-default/config.php /site-default/install/ /site-default/modules/ /site-default/templates/ [*]Now run the installer to complete the installation. Template details The template files in the profile take the approach of populating variables that are output within a main/shared markup file. This is different from the basic profile that ProcessWire comes with. Specifically, make note of the following files: /site/templates/_init.php – This file is automatically included before any template file is executed. We use it to initialize the variables we populate and include a shared library of functions. /site/templates/_out.php – This file is automatically included after any template file is executed. In our case, we use it to contain our main markup that also outputs the variables we populated. /site/templates/includes/functions.php – This is where we are keeping a shared library of functions, most for generating skyscraper list markup. /site/templates/*.php – These are the site’s template files, each named consistently with the page(s) they represent. The primary focus of these files is to populate the $content variable that is output by _out.php. The use of _init.php and _out.php are something new to ProcessWire 2.3. These are specified in the /site/config.php: $config->prependTemplateFile = '_init.php'; $config->appendTemplateFile = '_out.php'; Use of this new feature is optional. We’ve used it in this profile because it reduces the amount of redundant include() code necessary in each of our template files. Download Skyscrapers Profile at GitHub or download ZIP file Skyscrapers Profile at modules.processwire.com Remember that you must have ProcessWire 2.3 (or 2.2.12 dev branch) or newer to install this profile. 19 Link to comment Share on other sites More sharing options...
adamspruijt Posted January 5, 2013 Share Posted January 5, 2013 Great, thanks Ryan, I'm sure there will be many great concepts worth adopting in this profile. I'll have to take a look ASAP! 1 Link to comment Share on other sites More sharing options...
MarcC Posted January 6, 2013 Share Posted January 6, 2013 I love studying these. And of course I had my own init stuff going on with functions and variables, so I wondered what others were doing about that. Thanks Ryan! 2 Link to comment Share on other sites More sharing options...
MatthewSchenker Posted January 6, 2013 Share Posted January 6, 2013 Greetings Ryan, Since it's not possible to "multi-like" a post, I'll just unofficially add them here... Like Like Like Like Like Like Like Like Like Like Like Like I've been waiting for the Skyscraper profile to be available for the newest version ProcessWire. There is a lot in that profile that is extremely valuable. Thank you again for all your amazing work. Matthew 1 Link to comment Share on other sites More sharing options...
alan Posted February 11, 2013 Share Posted February 11, 2013 Looking forward to learning a lot of great lessons from this; thank you SO much for sharing Ryan! 1 Link to comment Share on other sites More sharing options...
roelof Posted June 19, 2013 Share Posted June 19, 2013 Hello Ryan, I tried to install yout theme exactly as described. But after the installation I only see iun the front page a 500 error and in the backend it looks like I have the standard theme installed. Can you help me figure out what went wrong so maybe I can make my site with PW. Roelof Link to comment Share on other sites More sharing options...
Soma Posted June 19, 2013 Share Posted June 19, 2013 Try to find if you have the session folder there if not create one in assets. Link to comment Share on other sites More sharing options...
roelof Posted June 19, 2013 Share Posted June 19, 2013 Oke, everythings works now after another install. Link to comment Share on other sites More sharing options...
RyanJ Posted August 20, 2013 Share Posted August 20, 2013 I would really like to get a detailed understanding of the Skyscraper profile functions file. These particular questions are in regards to the following two functions 1. function getValidSkyscraperSorts() { return array( // field => label 'images' => 'Images', 'title' => 'Title', 'parent' => 'City', 'height' => 'Height', 'floors' => 'Floors', 'year' => 'Year', ); } The above returns and array of fields and their labels, but what if you just had one field and label. No need for an arrary, so how would that look? 2. function renderSkyscraperListHeader() { // get the 'sort' property, if it's been used $sort = wire('input')->whitelist('sort'); if(!$sort) $sort = 'title'; // query string that will be used to retain GET variables in table header sort links $queryString = ''; // make a query string from variables that have been stuffed into $input->whitelist // to use with the table header sort links foreach(wire('input')->whitelist as $key => $value) { if($key == 'sort') continue; $queryString .= "&$key=" . urlencode($value); } $out = "\n\t<thead>\n\t<tr>"; // build the table header with sort links foreach(getValidSkyscraperSorts() as $key => $value) { // check if they want to reverse the sort if($key == $sort) { $key = "-$sort"; $value = "<strong>$value »</strong>"; } else if("-$key" == $sort) { $key = ltrim($sort, '-'); $value = "<strong>$value «</strong>"; } $out .= "<th><a href='./?sort=$key$queryString'>$value</a></th>"; } $out .= "\n\t</tr>\n\t</thead>"; return $out; } The above is very well explained, but lets say that you do not want to output the header sort links because you already have the header labels elsewhere. Or lets say you only want to be able to sort 2 of the 6 fields instead. Whats the best approach to sort just one or two of the 6 fields without outputting them all in the above function? For example, I would like to sort Height and Year only. Link to comment Share on other sites More sharing options...
ryan Posted August 22, 2013 Author Share Posted August 22, 2013 The above returns and array of fields and their labels, but what if you just had one field and label. No need for an arrary, so how would that look? In that case, you would't need the function at all. Your code could just do something like this: if($input->get->sort == 'floors') { $sort = 'floors'; } else { $sort = 'title'; } Whats the best approach to sort just one or two of the 6 fields without outputting them all in the above function? For example, I would like to sort Height and Year only. I think that putting them in a select box is a good way to go. See the modules site for an example: http://modules.processwire.com/modules/?sort=-created 1 Link to comment Share on other sites More sharing options...
RyanJ Posted August 22, 2013 Share Posted August 22, 2013 Thanks Ryan, that helps clear the murky water Link to comment Share on other sites More sharing options...
bwakad Posted March 24, 2014 Share Posted March 24, 2014 I noticed in the files architect.php and city.php these minor difference in code: $content = renderSkyscraperList(findSkyscrapers("architects=$page")); $content = renderSkyscraperList(findSkyscrapers("parent=$page")); But if I a not mistaking, they are basically telling the same thing, one explicitly and the other dynamically. Hope I am right? Link to comment Share on other sites More sharing options...
Joss Posted March 24, 2014 Share Posted March 24, 2014 I haven't ever looked at the skyscrapers profile, but the first is listing skyscrapers where the name of the architect is the same as the name of the current page (so finding anything to do with that particular architect) Whereas the second is listing the skyscrapers who's parent page is the same as the current page. So they are both explicit statements but looking for different criteria Link to comment Share on other sites More sharing options...
kongondo Posted March 24, 2014 Share Posted March 24, 2014 OK, so Joss was faster...but yes, that's it.The first will find, for instance, all Skyscrapers that were built by "Joss"...the second will find all Skyscrapers in a particular City, e.g. Chicago... 1 Link to comment Share on other sites More sharing options...
Joss Posted March 24, 2014 Share Posted March 24, 2014 Except it will throw an error as I have never build a skyscraper and I don't live in Chicago. But other than that ..... 1 Link to comment Share on other sites More sharing options...
bwakad Posted March 24, 2014 Share Posted March 24, 2014 That's funny I think I came along your unbuild skyscraper: https://processwire.com/talk/topic/5925-trying-to-expand-search-form/#entry57888 but in other words: considering architects (parent) > architect (child) $content = renderSkyscraperList(findSkyscrapers("architects=$page")); current page is architect (child) will give me items by architect (child). considering cities (parent) > city (child) > item-name (child) $content = renderSkyscraperList(findSkyscrapers("parent=$page")); current page is city (child) will give me the item-name (child) that has the parent city (child). I had to go through explanations several times. lol Link to comment Share on other sites More sharing options...
kongondo Posted March 24, 2014 Share Posted March 24, 2014 Uh? Oh, I wasn't clear...by architects have no children, I meant the individual architect pages, e.g. Albert Khan, etc...have no child pages..Anyway, I sorted out your issue in the other thread... 1 Link to comment Share on other sites More sharing options...
bwakad Posted March 25, 2014 Share Posted March 25, 2014 I am playing with the selector from skyscrapers - in the following code from the file: includes/functions.php function makePrettySelector($selector) { if(preg_match('/(architects|parent)=(\d+)/', $selector, $matches)) { if($page = wire('pages')->get($matches[2])) $selector = str_replace($matches[0], "$matches[1]={$page->path}", $selector); if($matches[1] == 'parent') $selector = str_replace("template=skyscraper, ", "", $selector); // template not necessary here } return $selector; } the selector returns output, explaining what was selected (to search). But what if I wanted to output anything what could be searched or selected? This code puzzles me : if(preg_match('/(architects|specialties|materials|parent)=(\d+)/', $selector, $matches)) { Is there no wildcard to use for this? Link to comment Share on other sites More sharing options...
adrianmak Posted May 4, 2014 Share Posted May 4, 2014 does it include demo data from the profile ? And could I install with latest PW 2.4 version ? Link to comment Share on other sites More sharing options...
kongondo Posted May 4, 2014 Share Posted May 4, 2014 does it include demo data from the profile ? And could I install with latest PW 2.4 version ? Yes and Yes 1 Link to comment Share on other sites More sharing options...
Marek Posted October 5, 2014 Share Posted October 5, 2014 does it also work with 2.5? i have a problem installing it. Link to comment Share on other sites More sharing options...
peterfoeng Posted October 16, 2014 Share Posted October 16, 2014 does it also work with 2.5? i have a problem installing it. Hi Marek, I am running 2.5.4 on this profile without any issues, what kind of issues are you having? Cheers 2 Link to comment Share on other sites More sharing options...
Marek Posted October 19, 2014 Share Posted October 19, 2014 After I connect to database and then click continue this is what i see ... nothing than happens Test Database and Save Configuration Database connection successful to pw_sky4 Saved configuration to ./site/config.php Link to comment Share on other sites More sharing options...
Mont Posted November 6, 2014 Share Posted November 6, 2014 I also cannot get it to install on a 2.5 installation. I have copied the files to site-default folder and when I go to install page the default is not showing, only the other profiles. Link to comment Share on other sites More sharing options...
Nico Knoll Posted November 6, 2014 Share Posted November 6, 2014 "site-default" is probably the same as "Default" in the dropdown, isn't it? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now