Leaderboard
Popular Content
Showing content with the highest reputation on 08/15/2014 in all areas
-
Disclaimer This is not a step by step tutorial, but the script posted serves as an example of how easy it is to bootstrap ProcessWire(PW), query an external API (in this case, Strava) and import stuff into PW pages using the PW API. To the import! So i wanted a quick, easy and automated way to import someones Strava activities into his/her own 'activity feed' on a certain PW website. Strava has an API which you can use to -amongst other things- get your own activity data. After setting up my Strava app i had access to the API. Next step was to import the JSON data i wanted into PW pages. This was as easy as creating a PW bootstrapped script (see code below) and using the PW API to import the data into Pages. For convenience in talking to the Strava API i used a library that is available on Github. To keep track of what was happening i decided it would be nice to log the import results to a log file. Luckily, PW had me covered by using the WireLog class (/wire/core/WireLog.php). Result With some googling on Strava and a (very) basic knowledge of PHP and the PW API i was able to get things working in no-time. With no other CMS i've worked with -and i've had dealings with quite a few- it would have been so easy to get the desired result. Some notes about the script: PW version used: 2.4.12, but should work in earlier versions as well. It does not create templates, fields and pages for you. If you would want to use it (maybe as a starting point), create templates, fields and pages for your own needs and adjust the script accordingly. Also remember to adjust script paths. In the posted example i don't do any sanitizing on the Strava data. You maybe should In production you would maybe call these kind of importers via a cronjob, and make it non-accessible from the outside. It served my purposes. There might be better ways of handling this stuff. All suggestions and/or questions are welcome. In this case the script was/is called importer_strava.php , located at mydomain/importer/importer_strava.php and requested manually. See notes above, number 3. <?php /** * Strava Importer * * This crude script will import your own Strava activities into newly created * PW pages under a given parent page. The import result will be logged in: * /site/assets/logs/importer_strava.txt, using the WireLog class. * * For this to work you first need to create an app via http://www.strava.com/developers * Strava API reference: http://strava.github.io/api/ * * The PHP library used for working with the Strava v3 API can be found at: * https://github.com/iamstuartwilson/strava * */ // Bootstrap Processwire include __DIR__ . '/../index.php'; // Include the PHP Library for working with the Strava v3 API include __DIR__ . '/StravaApi.php'; // Strava credentials (you can get these from the Strava app page you've created) $clientId = "Your clientId"; $clientSecret = "Your clientSecret"; $accessToken = "Your accessToken"; // Connect to Strava $api = new StravaApi( $clientId, $clientSecret ); // Set the parent where activities will be stored as child pages $activity_parent = wire('pages')->get("/activities/"); // Get new activities $results = $api->get( 'athlete/activities', $accessToken, array( 'after' => $activity_parent->strava_last_checked ) ); // Uncomment if you want to inspect the $results response onscreen // echo "<pre>"; // print_r($results); // echo "</pre>"; // Import new Strava activities to PW Pages if (empty($results)) { // Log that no activities have been imported $text = "No new activities have been imported"; $options = array('showUser' => false, 'showPage' => false); wire('log')->save('importer_strava', $text, $options); } else { $numImportedPages = 0; // Start counter for number of imported pages foreach ($results as $result) { $p = new Page(); // Create new page object $p->template = 'activity'; // Set template $p->parent = $activity_parent; // Set the parent // Assign $result data to the corresponding Page fields $p->name = $result->id; $p->title = $result->name; $p->act_distance = $result->distance; $p->act_moving_time = $result->moving_time; $p->act_elapsed_time = $result->elapsed_time; $p->act_total_elevation_gain = $result->total_elevation_gain; $p->act_type = $result->type; $p->act_start_date = substr($result->start_date_local, 0, 10); $p->act_average_speed = $result->average_speed; $p->act_start_lat = $result->start_latlng[0]; $p->act_start_long = $result->start_latlng[1]; $p->act_end_lat = $result->end_latlng[0]; $p->act_end_long = $result->end_latlng[1]; $map = $result->map; $p->act_map_polyline = $map->summary_polyline; $p->save(); // Save the Page object $numImportedPages++; // Increment counter } // Log the number of activities that have been imported $text = ($numImportedPages == 1) ? "$numImportedPages new activity imported" : "$numImportedPages new activities imported"; $options = array('showUser' => false, 'showPage' => false); wire('log')->save('importer_strava', $text, $options); // After the import, update Field 'strava_last_checked' to current Unix timestamp // This could also be placed outside of the 'else' to update on each script run $timestamp = $activity_parent; $timestamp->of(false); // Turn off output formatting before saving things $timestamp->strava_last_checked = time(); $timestamp->save('strava_last_checked'); }7 points
-
I reuse fields as much as possible and try to avoid having too many fields. I have a "firstname" field that could be used on different templates. I don't prefix fields. PW is designed to reuse fields. I wonder how many fields you have and why you need to prefix them. I think people tend to create new fields for every template and context, which could lead to 100s of fields. Remember there's template context for fields in PW, you can customize labels and some setting from within the template if you click on a field name.5 points
-
Hi, I like to introduce a newly built site to you. http://www.travelinluxury.nl Without Processwire it would have been much more complex to built it. The first left menu you see is not a simple menu but a list of types of trips that are added to all destination pages through the use of a multiselect pagefield. After a click it searches the complete site and selects parts of the world and countries where destinations are to be found with what you selected with final menus to the destinations. With a normal CMS it would have been a real problem to create something like that. The tabbed blocks on the destination pages are built with Jeasyui and in the admin the blocks are separate template fields. Beside that I use the MapMaker Module and FormBuilder (see newsletter and "offerte aanvraag"). Also multilanguage fields (Dutch and German). See the link in the botton (NEDERLANDS - DEUTSCH).. Every page has it's own slideshow for which I used the Jquery cycle plugin with Maximize (thanks my form posts and the suggestion of MadeMyDay...). Check the small cross next to the slideshow controls..... Plus a lot of Jquery and finally pocketgrid for the css grid to make it responsive (tablet only). There are still some little issues, that will be finished the coming weeks. Using Processwire for this site was a learningpass but I enjoyed it much4 points
-
I think this will work $nav_sides = $pages->get('/')->nav_side; if ($nav_sides->has($page)) { //... }4 points
-
So i've somehting to share expecially for beginners with processwire!! I'm like others here not really satisfied with the forum search - so i decided to make a google custom search page https://www.google.com/cse/publicurl?cx=014789015761400632609:fxrf0rj4wr4 but the optical result is not that i imagine so i created a very small html page with the PW Logo + Google CSE JS Code and now it looks better.... so i've had a fast search on the /talk/ /api/ /docs/ and cheatsheet pages from processwire.com! so maybe it's usefull for anybody? Have Fun PW-Search.zip4 points
-
What you are thinking is something that certainly is not wrong and should work fine, and this has also been discussed in the past on this forum. The native forum search isn't the best but if you do a Google search like this 'site:processwire.com/talk single page website' you should get some interesting results. Stuff like this could be good reads for you to get some inspiration: https://processwire.com/talk/topic/1283-a-single-page-site-using-pw/ https://processwire.com/talk/topic/5919-hide-children-of-home-from-indexing-single-page-site/ https://processwire.com/talk/topic/2845-single-page-websites/ https://processwire.com/talk/topic/3036-one-page-website-template-setup/3 points
-
now I made it for Firefox! Take a look at this site: http://www.searchplugins.net/generate.aspx Search URL: https://www.google.com/search?q=site:processwire.com%2Ftalk+TEST Suggestion URL (optional): https://www.google.com/search?q=site:processwire.com%2Ftalk+TEST Search plugin title: ProcessWire Forum Search Icon: uploaded a small copy of the PW favicon result: <SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/"> <os:ShortName>ProcessWire Forum Search</os:ShortName> <os:Description>ProcessWire Forum Search</os:Description> <os:InputEncoding>UTF-8</os:InputEncoding> <os:Image width="16" height="16">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEgAACxIB0t1+/AAAARFJREFUOE+lj78vBFEUha8/Y2u9RrOtVrQSlUqrVqlIyCYaGqIQsYVssQ2VKES22yBRkGCtyWQQM3atf+DIh7s/srNidyb55r533znn3TeW267Jsnzje3VlwSYOn/QX+XKg6aNQk6UgVWcIBrFw/qKVy7jN3GnUp7Wp40BpIN64TvpAy4XusZmTUN3MV561+mvcum30BLBnIiZzj82eRQKMSxdvQvQf1q9iMaVhXKy+ave+OTT4jB9vHSWApxpjYz6ofwykGP2c7QeNHg1eW76Jtfn4LkSlsNWurNP23sOD19buEhUeOgEu8EAPomIC9PjAvEHdCZvfeI81Y3uv+8zDzE2jVmNU4CZfD1OtnHwqC1/QKAe2frywFgAAAABJRU5ErkJggg==</os:Image> <os:Url type="text/html" method="GET" template="https://www.google.com/search?q=site:processwire.com%2Ftalk+{searchTerms}" resultDomain="google.com"> </os:Url><os:Url type="application/x-suggestions+json" method="GET" template="https://www.google.com/search?q=site:processwire.com%2Ftalk+{searchTerms}" resultDomain="google.com"> </os:Url><os:Url type="application/opensearchdescription+xml" method="GET" template="http://www.searchplugins.net/createos.aspx?number=81717" rel="self" resultDomain="searchplugins.net"> </os:Url> </SearchPlugin> Then create the plugin and install it in FX. EDIT: give the new plugin in Firefox a keyword (character), so you don't need to change the search. My example character is p. E.g. you type p field dependencies in the adressbar, hit enter --> ready2 points
-
No stupid questions here Andrea - we are all learning Enjoy your PW discovery - it's a whole new world!2 points
-
Hi @a.masca and welcome to the forums. Don't mess around with Hanna for videos: http://modules.processwire.com/modules/textformatter-video-embed/ And this for google maps: http://modules.processwire.com/modules/textformatter-google-maps/2 points
-
Still in Beta but safe to use but I need to add some features before going stable (e.g. scheduled publishing, etc) . Other than that, it works fine...2 points
-
Orbit is ugly with z-index stuff, Slick Slider looks great I like the 'API' Methods.2 points
-
Thanks Horst, your tip for turning on Debug solved my problem. I did not know there was a Debug setting. Debug gave me an extensive list instead of the short error message. The problem came from having one file in the template directory named "!tmp.php". Just a scrap file I used as clipboard for bits and pieces, named with a leading "!" so that it would sort at top of the file list in my editor. Now, the "!" in the file name was the culprit. Naming or renaming any PHP file in the /template/ directory with a leading "!" will re-create the problem. Lesson of the day: Do not use leading "!" in template file names. Thanks everyone helping out in his forum. Process Wire is just amazing.2 points
-
new german updates for actual PW dev 2.4.12 (14 August 2014). Zip contains only updated/added files (in comparison to the default 2.4 lang pack). updated files: wire--modules--inputfield--inputfieldckeditor--inputfieldckeditor-module.json wire--modules--process--processforgotpassword-module.json pw-lang-de-dev-update.zip2 points
-
Hey guys, first, ProcessWire is a great piece of software. Thanks for that and the great community behind that. So, i'm realy new to ProcessWire, but i will present you my first module for SEO- and performance optimizing: AIOM+ (All In One Minify). AIOM+ (All In One Minify) for CSS, LESS, JS and HTML AIOM+ (All In One Minify) is a module to easily improve the performance of your website. By a simple function call Stylesheets, LESS and Javascript files can be parsed, minimized and combined into one single file. This reduces the server requests, loading time and minimizes the traffic. In addition, the generated HTML source code can be minimized and all generated files can be loaded over a cookieless domain (domain sharding). Install AIOM+ Download current release (link below) Extract and copy the files for this module to /site/modules/AllInOneMinify/ Login to PW backend and go to Modules > Check for new modules Install Module > AIOM+ (All In One Minify) for CSS, LESS, JS and HTML Alternative in ProcessWire 2.4 Login to PW backend and go to Modules Click tab "new" and enter Module Class Name: "AllInOneMinify" Click "Download and Install" Features Combining stylesheets / LESS files or JavaScripts Minimize the combined files No change to the .htaccess necessary (except for the domain sharding) Server-side LESS parsing without plugins HTML source code minimization Cookieless domain / domain sharding Automatic cache management (With changes to the source file, the cache is rebuilt) Configurable via the backend Automatic rewriting the paths in the stylesheet and LESS files. No changes are needed Optional developer mode (combining, but no minimize and browser cache prevention) Clear the cache on the backend Conditional loading for CSS, LESS and JS (since Version 3.1.1) How to use Minimize multiple stylesheet or LESS files into one file. You can even mix stylesheet and LESS files in parsing and combining process! <link rel="stylesheet" href="<?php echo AIOM::CSS(array('css/file-1.css', 'css/file-2.less', 'css/file-3.css', 'css/file-4.less')); ?>"> Minimize multiple javascript files into one file. <script src="<?php echo AIOM::JS(array('js/file-1.js', 'js/file-2.js', 'js/file-3.js', 'js/file-4.js')); ?>"></script> Conditional loading (same with Javascripts) <?php $stylesheets = array('css/reset.css', 'css/main.less', array('loadOn' => 'id|template=1002|1004|sitemap', // PW API selector 'files' => array('css/special.css', 'css/special-theme.less'))); ?> <link rel="stylesheet" type="text/css" href="<?php echo AIOM::CSS($stylesheets); ?>" /> More Information, Documentation and Download AIOM+ in ProcessWire repository AIOM+ on GitHub So, I hope you can do something with this module. Dave1 point
-
Ok, let's make it really simple for people using chrome to do this If you are using chrome do this to have PW search with google on the omnibox by simply typing "pw [spacebar]" 1. right click on the omnibox and chose "Edit Search Engines" 2. scroll down until you find these input fields 3. Fill them as in the image: third field should be https://www.google.com/search?q=site:processwire.com%2Ftalk++-site:processwire.com%2Ftalk%2Fmembers%2F+-site:processwire.com%2Ftalk%2Fuser%2F+%s This is the equivalent to this search in Google: "site:processwire.com/talk -site:processwire.com/talk/members/ -site:processwire.com/talk/user/ %s" where %s is the query 4. type "pw [spacebar] Edit Search Engines" and see if this thread appears in first PS: I'm sure there is an equivalent way to do this in other browsers, but I'm not going to look for that now. Edit: simplified the url1 point
-
Like I mentioned in another topic I'm working on a theming system for Processwire. Today I finished a huge step in the right direction: A theme switcher. How does it work It's really easy. Frontend Themes are modules, (I added two testing Themes to the attachment), which only contain the module information (version, author, name, ...). They are based on a module called "WireThemes" which is included, too. WireThemes is the main controlling class. It rewrites the path of "$config->paths->templates" and "$config->urls->templates" which afterwards pointing to the folder of your Theme and contains the installing and uninstalling methods. What I'm still working on ProcessWire's great strength - but in case of theming a big complication - is that you have to/can create fields by yourself. So it's hard to create a theme which fit's on every system. That's why I'm still brainstorming how to make this easier. Possible solutions I see at the moment are: Creating a site profile with the most used fields Creating a json file for ProcessMigrator Hoping that the 2.5 default site profile includes the most used fields so I wouldn't have to change something ... Please try it and tell me about any problems. And if you have additional ideas this is the right place to write about them. Download: https://github.com/NicoKnoll/WireThemes1 point
-
I have build another non-profit website http://www.fmgcs.com with ProcessWire 2.4 completely free! This my community website which I redesigned and hookup with ProcessWire. Before it was static html pages. I have spent quit a bit of time on designing and customizing templates. Please provide your feedback as you normally do. Thank you!1 point
-
1 point
-
1 point
-
I get the feeling that the field contexts are something that is easily missed but very useful to know. Once you make use of contexts you can also see and edit the different ones from the field page.1 point
-
1 point
-
Remember to switch off debug mode before going live (on a remote server). Debug 'true' should never be used on a remote server...for security reasons...1 point
-
1 point
-
Kongondo, is your blog module out of beta and can be used already safe ? I read a lot of good things about your blog modules and are going to install them this week-end.1 point
-
With that method you posted, and the first argument is the product page. echo $modules->get("ShoppingCart")->renderAddToCart($product);1 point
-
Hi Ryan I have a series of fields that I wanted to only show to superusers. I used this module to set access to a fieldsetTab group and lo and behold - the tab and all its contents were hidden from other users. However, as I added other tabs, this behaviour stopped working - I think some glitch had made it work originally. Might it be an idea to enable this behaviour - ie a protected fieldsetTab or fieldset also protects any fields it contains. Just a thought - it would make things cleaner in the admin interface. This is obviously v v low priority. Thanks again Ryan. Many thanks Nik1 point
-
Hi Webweaver, Glad you like the module. It is truncating fine for me here. The code is pulling text to truncate from blog_body. I decided to skip over using a blog_summary since truncation can be done from blog_body. I am guessing it is not truncating because you have not set the second parameter/argument of renderPosts() to true. The default is false (i.e. do not truncate). Apologies for this; I have delayed with documentation but I am currently writing this. Here's example code to make it truncate. $blog = $modules->get("MarkupBlog"); $limit = 10; //limit will be passed to the selector fetching blog posts; //'true' will truncate posts to what we have set in blog_quantity but default to 450 if this is not set $content = $blog->renderPosts("limit={$limit}", true); echo $content;1 point
-
Thanks teppo, Good tip on the include part. Updated the posted script with __DIR__ because i really don't want to encourage taking anything < PHP 5.3 into consideration Hell, even PHP 5.3 is already nearing end of life ( http://php.net/archive/2014.php#id2014-08-14-1 ) About Strava; There are a lot of activity trackers out there that do the basics right. In the past i've also briefly used Endomondo and Runkeeper and they are fine too. What i like about Strava: The non-intrusive social features; making friends, following, creating clubs etcetera. The famous Strava segments, where one can become "King of the Mountain". This should not be taken too seriously but me and my cycling buddies have been in serious competition with each other on our 'home' segments and having a lot of fun while doing so. There are quite a lot of Pro's on Strava, which can be nice to follow, if you're into that. It has a nice platform for developers. It just feels like it has some momentum going. What could be considered a downside is that they don't have an official Windows Phone app. So if you wanted to use your Windows Phone to do the tracking you are left out in the cold. Of course, there are ways around this with very decent third party apps, that allow to sync activities to Strava, but then you do miss some of the features. But you could always use the Strava website to fill in those gaps.1 point
-
You could take a textarea field, and take that to enter option one per line and use that to populate the select.1 point
-
Bwakad, Moved this here (general support forum) from the FAQ from which is for 'Answers to frequently asked questions about ProcessWire.'1 point
-
@xorotle: has you set debug to true? (site/config.php -> $config->debug = true;) have you entries in your site/assets/logs/error.txt ? (after switching debug to true?)1 point
-
Update: Minor version bump to 1.2.1 after some minor styling issues updates. Documentation: I am taking a short break from writing code to write some badly needed documentation for Blog (and some other PW tutorials if I get time ). I am writing this documentation as tutorials which I will post on my website soon. I'll keep you updated. I haven't forgotten any Blog features pending requests1 point
-
Wasn't there a thread a couple of days ago about bringing processwire into enterprise ? Modules like this surely are a way to go.1 point
-
my favourite 2 ways are by no specific order: 1. Add a "featured" checkbox to each page and show the last 3: $pages->find('featured=1, sort=-date, limit=3'); 2. Add a page field in the homepage where your client can add pages, and show the top 3 from that field.1 point
-
1 point
-
1 point
-
A SEO 'cheatsheet' would never be limited to PW. The same rules apply to more or less everyone. Just put your title and description meta tags in good shape and make well formed and to the point (html) content and you should be fine. Take care of heading levels and such and do not ever underestimate the power of Google and the like. Most of times it is some kind of specificity and traffic kind of magic. For further SEO tips and tricks there's plenty to go around if you just Google. No amount of trickery (apart from maybe sponsored ads ) will get you on top op of Google for example 'harry potter books', unless you're Wikipedia, Amazon or author sites.1 point
-
In case anyone is interested in trying out some of the things I was talking about in previous posts here, the latest dev branch has a field import/export function. You'll see it in the lower right corner of Setup > Fields. It enables you to copy and paste any fields across any PW installations. Locally, I also have this working for templates (with fieldgroups), though that part needs a little more work so it's not yet committed. I also have fields, templates and fieldgroups mirroring every change to JSON files, as an option that can be enabled for those that want to version these things with Git and what not. That part also isn't yet committed to dev, but will be soon. However, I figured the copy/paste function probably had the largest use potential. It makes migrating field changes (or creation of new fields) quite a simple task. Next up on the commits will be the same thing for templates (with fieldgroups). (note I didn't take these screenshots together, so they aren't referencing the same fields).1 point
-
Well you just set the fields from the other page, and the $page will still be the same page object just with new content (on runtime). $p = $pages->get("/somepage/"); foreach($p->fields as $f){ $page->$f = $p->$f; }1 point
-
I have it run!! I'm not sure I can follow you completely and I have a difficult time understanding what is wrong with your setup and how much you understand what you're doing. First, my setup is like this: We need a multiple select page field you can select from all page in your site tree, that is.. - pagelist_hidden - a page field, multiple page (page array) checked, the setting is "Home" page as the parent and the inputtype is PageListSelectMultiple* - No I attach this field to the user template (system template needs template filter set "Show system templates?" to show) So now I can select and add pages that should be hidden on every user page, since user template now has this field. Now if you login with the user, page are not shown in page tree anymore. This module does only this to filter those pages out on the ajax json response the admin page tree works with. It's more of a workaround and proof of concept / example module. It shows how it could be done. While this is simple, adding more features and configuration would go pretty complex and I'm not sure it's a route we should promote. Even just to reverse and add pages the user should see is a differnt thing considering a tree based structure. It's doable but maybe should be avoided. I your case it sounds like every time a new user is added you need to do a lot and add the new pages to each user. And you have templates for each user, but all the same setup? To get around the template based permissions I guess? I think it also could be avoided by using almost exact like module to add pages the user can edit and go with one set of templates. I think there's also some examples or even a module by Ryan around. https://github.com/ryancramerdesign/PageEditPerUser http://processwire.com/talk/topic/2141-module-page-edit-per-user/ http://processwire.com/talk/topic/3051-page-edit-per-user-and-template-access-how-do-they-relate/1 point
-
Ok since you hook Page::viewable every page in PW will be somehow affected, even admin pages as they are also just pages. So the message with $event->object->name is the admin pages rendered in the admin template. I'd guess it's the navigation. But since the ProcessPageList module is ajax driven you won't see any messages from there. $event->arguments is nothing there I think, as the important with these page access hooks is the $event->return value. So you would do set it to false or true $event->return = false; // page won't be viewable All the viewable hook does is define if a page is viewable or throw an 404. In case of the admin page tree the page will still be visible and only have no -view- action button. That's all. If you really want to hide pages in the admin I'm with Ryan, but see that there's cases where it would be nice to hide pages from users and keep a branch hidden from them. I already stumbled and tried very hard 1-2 years ago, but realized it's not easy as there's no obvious hooks available where needed and it's done with ajax and there's some things to consider, didn't really bother. Now after thinking for some time and try error I found an easy way to just remove pages from the page list tree. The trick is to modify the JSON output that goes with the ajax response, convert it to an array and Long story short here's an example module for those interested. I used a pagelist_hidden page field added to the user template to define pages that are hidden for a user. Of course there could be endless configuration possibilities, with roles and what not, but don't want to go any further and maybe someone else finds this useful or as a start for a new module. If Ryan reads this and is still with me. Would you consider adding some hooks to ProcessPageList.module? Or do you think the JSON manipulation is a good way? Most likely there would have to be some additional take care to make those pages also not editable. Those page will still be accessible manually through admin url. Such a module shouldn't be used to hide pages for access restriction, and it's only and best suited for hiding "private" branches in the admin, or functional pages that can't be in the /Admin/ branch for some reasons.1 point
-
This is in fact simple to do, but it does require knowing how to put it together without a CMS first. So I would suggest getting your layout up and running as a functional mockup, outside of ProcessWire or any CMS (just HTML and CSS). You could also get by with using an existing HTML page that already does these things. Lets say you've now got that in a file called home.html. With a fresh install of ProcessWire (using the included profile, not the blog one), you'd copy your home.html file to /site/templates/home.php. Now view the homepage on your site. You should see your page. If some things are broken, then that is because the links to the CSS files and other resources have changed. Typically we place our CSS files in /site/templates/styles/ and our javascript files in /site/templates/scripts/. But you can place them wherever you want. Wherever you place them, you'll want to update your /site/templates/home.php file to reference them directly. So if you had a line at the top that said this: <link rel='stylesheet' type='text/css' href='css/style.css' /> Then you'd copy everything from that old 'css' directory into /site/templates/styles/, and then update your code to say this: <link rel='stylesheet' type='text/css' href='/site/templates/styles/style.css' /> Better yet, make it say this, so that it will continue working no matter where you happen to move your site: <link rel='stylesheet' type='text/css' href='<?=$config->urls->templates?>styles/style.css?>' /> With that line above, we're asking ProcessWire's $config variable for the URL to the templates directory. Since it determines that at runtime, it'll work whether your site is running from root or a subdirectory. Once you've got your homepage looking the same as it did outside of ProcessWire, then you are good to move forward with the next step, which is to make it dynamic. This short tutorial will get you started and give you what you need to know to proceed with your magazine style blog homepage. There are also more tutorials in the Wiki that you may want to check out after covering the basics.1 point
-
1 point
-
Regarding workflow: the default profile is pretty much always my starting point. It's rare that I don't end up repurposing the fields and templates that are already there to start building things out. Likewise, I usually end up just renaming (as necessary) and repopulating the pages that are already in the default profile. Then I will start adding new fields, followed by templates, specific to the needs of the site. While I try to determine most of the templates/fields that I'll need ahead of time, I will continue adding fields and templates throughout the entire development process as necessary to make the site do what I want it to. Most larger PW sites are pretty relational and make good use of Page references. But this is also the part that I think is most important to outline when it comes to workflow. This part is quite a bit different from other systems, but has major advantages. I try to make my selectable Page references part of the site's structure, if at all possible. For example, on tripsite.com, every bike tour has a "country" page reference field, and those countries are useful in the site's overall structure (Netherlands in this case): http://www.tripsite.com/countries/netherlands/ In other cases, page references might not fit as part of the site's general structure, so I'll have a /tools/ section in the site where they live. Though it's easy enough to make them function as pages, so I figure why not. Here are a few examples (they are all using the same template): Multi-page reference field "months" (April in this case): http://www.tripsite.com/tools/months/april/ Multi-page reference field "tour_types" (Guided in this case): http://www.tripsite.com/tools/tour-types/guided/ Page reference field "difficulty" (Difficult in this case): http://www.tripsite.com/tools/difficulty/difficult/ The template used on those pages is not much more than this: $tours = $pages->find("template=tour, {$page->parent->name}=$page, limit=10"); foreach($tours as $tour) { // output the tour } Admittedly, most of my projects are rebuilding existing sites, so I usually have some (or a lot) of data to migrate to the new site. This becomes a major component of the development workflow, so I figured I should mention it here. After I've setup the necessary fields and templates (and usually before front-end development), I'll work on bringing in the new data. If it's a relatively simple conversion job, I might use the ImportPagesCSV module. But most jobs require some markup replacement, character set conversion or other things, so I'll build my own import script. This is where I like to bootstrap PW from a command line PHP script. Here's a simple example: /import-airports.php #!/usr/bin/php <?php require("./index.php"); // bootstrap PW $fp = fopen("./airports.csv", "r"); while(false !== ($data = fgetcsv($fp))) { $page = new Page(); $page->template = 'airport'; $page->parent = '/building-types/airports/'; $page->title = $data[0]; $page->location = $data[1]; $page->year = $data[2]; $architectName = wire('sanitizer')->pageName($data[3], true); $architect = wire('pages')->get("/architects/$architectName/"); if(!$architect->id) { $architect = new Page(); $architect->template = 'architect'; $architect->parent = '/architects/'; $architect->title = $data[3]; $architect->name = $architectName; $architect->save(); } $page->architect = $architect; $page->save(); echo "\nCreated page: {$page->url}"; } Once I've got a lot of data to work with in the system, I'll start doing front-end development: creating the template files, markup, css and anything else necessary to handle the output for the site. The files from the basic profile either get used as a starting point, or replaced completely at this point. These are my main workflow components I can think of, but let me know if there are any specific areas you'd like more detail on or can think of anything I've missed.1 point