Leaderboard
Popular Content
Showing content with the highest reputation on 07/31/2012 in all areas
-
Here is the first release version of the Blog Profile! http://modules.proce...s/blog-profile/ It is now up on GitHub as well: https://github.com/r...ign/BlogProfile Below is a lot more talk about this blog profile and how it works, but if you just want to install the profile and test it, it's not necessary to read anything further unless you want to. I've simplified this a lot from where it's been. It does all the same stuff on the front-end, but the code behind the site is no longer a huge departure from the basic profile. I've rebuilt this profile 3 times trying to find the right balance between making it as flexible as possible and making it as easy to understand as possible. I think it's got a better balance now than before. It's now at a point where it does everything it always has, but the template code behind it should be a lot more accessible and easy to understand. There is no longer a separate module or API variable. Everything here just happens in /site/templates/ files. Consistent with making it simpler, I've also removed the drag-n-drop theme support. While it was cool to have, it always felt a little dirty introducing some kind of proprietary theme support that was so different from the way I'd build any other site. This thing is pretty darn simple to theme as it is (just edit a CSS file). Maybe we'll take it further in the future, but we don't have many PW site profiles out there right now (1 or 2?) and so I decided this profile needed to stay more accessible on the back-end. How the template files work In ProcessWire there are any number of ways you can use your template files. In this case, we are using our template files (in /site/templates/) to populate 3 variables ($content, $headline and $subnav) and then including an HTML file (main.inc) to output them in the right places. The $content variable represents the center (body) column, the $headline variable represents the text headline of the page, and the $subnav variable represents the navigation that appears in the left sidebar. Once one or more of these variables is populated, the template file includes the /site/templates/main.inc file. That main.inc file is just a big HTML file that outputs the $content, $headline and $subnav variables in the right places. We've made an attempt here to separate most of the logic used in the template files from the output. Most of the markup is generated from files in /site/templates/markup/. These files are included from the template files to output specific things like a blog post, comment, etc. Because a lot of output needs are similar among the various template files, we've created a file called /site/templates/blog.inc that has a few shared functions in it. If you look in any of the template files, you'll see that most of them include blog.inc as the first thing. This blog.inc file also initializes our $content, $headline and $subnav variables, mentioned earlier. Outline of /site/templates/ with this profile /site/templates/blog.inc Shared blog-specific functions included by most site templates. /site/templates/main.inc The main HTML markup file through which everything is output. /site/templates/markup/ Contains PHP files that generate markup for specific things like posts, comments, etc. This is separated from the site templates to make it simpler for you to modify the markup if you want to. This is primarily used by the blog.inc functions, but also included by a couple templates as well. /site/templates/skeleton/ This is the Skeleton CSS framework. It is identical to the one they distribute except we added a wider viewport to it. You probably wouldn't have much need to edit anything in here. /site/templates/styles/ Stylesheets used by the blog profile. The most useful one in here would probably be theme.css, which contains all the color definitions for the profile. /site/templates/scripts/ Javascript files used by the blog profile. Not much is happening in here at present.4 points
-
MacOSX Github App first steps Since ProcessWire modules directory supports and encourages you to use github for publishing modules and third-party content here's a little help getting started with github for mac. Go and install the app for mac here http://mac.github.com/ You'll have to first create a github account to where you can connect. Creating public repos is free, on top you'll see a "Free for open source" and a small button. https://github.com/plans Login in from your newly installed github app. Create new local repository by simply dragging the folder (your module) right into the app. The folder can be anywhere on your computer, maybe you choose to use the github folder automaticly created under ~user folder, or you decide. After you added it to github you'll see added a ".git" folder in your local repositiory. Now you'll see your files added in the app. Maybe you'll see the annoying ".DS_Store" file in there too. To ignore files simply right click on them and select "ignore". It will get added to the .gitignore file which now also appears in the files. Do the same and ignore it too. Now push the newly created repo to github using the button top right "Push to github". You'll be asked to enter a title and description then you can push it. It now will appear on github, but still empty. Now make your first initial commit, add a description i.e. "inital commit" and press "Commit" button. You'll see it add's a "Unsynced Commits" panel underneath. Press the button on top right "Publish branch" button and it will push it to the remote repository. You should now be able to see the files commited on your github page. On the repository page you'll see a "ZIP" download button. You can use that url to enter in the download field for the module when you add it to http://modules.processwire.com. Once you update the module, you have to enter a new version both in the module getModuleInfo() and on the module page. This makes sure people, also some apps using the webservice, know it is new and can update it. Screencats The following is a short screencats (no audio) showing me adding a new repositiory to github and update it using the mac github app. Screencast using MacGithubApp3 points
-
Hi folks I thought I'd post up a quick, basic tutorial of how to get started with Github and not have to learn any of the command line code. It's still recommended that you learn the basic commands, but this is aimed to help Git newbies like me get their modules on Github with the minimum effort possible. Check out the PDF below and have fun GitHub for Windows.pdf2 points
-
2 points
-
Hey Ryan, could you write a little on how to start with MarkupCache please? How it is used, what are the situations you want to use it and such; I for instance would like this to use with textformatter: I am running quite heavy processing on parts of page content, and would like to cache the result, so I don't have to rerun it again, but I am not sure, where goes what with MarkupCache. Thank you1 point
-
Thanks Nico, this is basicly what I do. Though I got other github url to deal with (though it could be easily changed) but good to know github api.. I actualy also looked at your module when creating my module. New update 0.0.8 I commited a new update yesterday. Added additonal check for "allow_url_fopen" and throw error if not enabled. I changed to use copy() instead of curl. I tested it locally and on a low budget hosting and a good one, now it works on all without problems (though locally I got permission problems though not relevant). I found that using copy or file_get_contents would work better, curl gave me "open_basdir" (low budget shared hosting) error on which would cause problems if not configured correctly on server. So this should be better now. Not sure about other restrictions and limits (size?). Also improved the remove function to recusively remove the extracted folder after content is copied, it now also deleted .* files like .htaccess. If you already got it installed just click "refresh" then "update" the module. Oh and let me know if any issues arises. Edit: Heh, just refreshed and new categories and modules pop up! Love it.1 point
-
have you tried to write checked="checked" ? Also PW I think stores it using value 1 or 0, but for the input html field you either only need checked="checked" or nothing (no value) attribute and it will be in the post as 1 or not at all, depending on it.1 point
-
if($tagPage instanceof NullPage) { ... } You can also do this to accomplish the same thing (at least, I prefer the syntax): if(!$tagPage->id) { ... } Also wanted to mention that the call to $videoPage->of(true); should instead be $videoPage->of(false). That turns off output formatting for the page, putting it in a save state (vs. presentation state).1 point
-
I would expect to get this error if doing a "continue;" outside of a foreach. Did you place the "continue;" within the foreach? It should have been placed right before the line that has: $r->setOutputFormatting(false); If that still doesn't work, then you can just use an if() instead: if($input->post->submit) { $r->of(false); // turn off output formatting $r->cost = $input->post("cost_$r"); // and do the same with your other fields $r->save(); }1 point
-
Sorry for that, I shouldn't post when I havent sleept in 48 hours.. But you answered the right there.. I wanted to cache the images.. And btw, Im loving PW more and more for everyday Im working with it.. Thanks for you hard work..1 point
-
1 point
-
especially when someone answers their own question1 point
-
you just have to assign the page object to the field. //assuming that the video page was created before this foreach ($tags as $tag){ // get the corresponding tag page $tagPage = $pages->get("template=tags, title=$tag"); // if the page doesn't exist, create it if(!$tagPage->id){ $tagPage = new Page(); $tagPage->template = $templates->get("tag"); $tagPage->parent = $pages->get("/tags/"); $tagPage->title = $tag; $tagPage->save(); } // assign the tag page to the video page $videoPage->of(false); $videoPage->tags = $tagPage; $videoPage->save(); } Voilá! Didn't test this, but should work Edit: corrected the code according to what was said in the next two posts1 point
-
Whoops, nevermind. It's including both classes now. This must have been an error on my part somehow. Thanks!1 point
-
Thanks Ryan it works! Like this it can be used with a callback. Not sure what about jQuery adding it's own with random number and =timestamp, but using data: {} to overwrite it works. function callback_json(data){ console.log(data); } $(function(){ var $res = $.ajax({ url : "http://modules.processwire.com/export-json/admin-hot-keys/?apikey=pw223", dataType: 'jsonp', data: {callback : 'callback_json', 'of' : 1 } }); });1 point
-
I like these posts, clear titles, quick answers.1 point
-
I just want to add a few statements: 1) PW-forum is the first forum, which makes me want to participate. 2) I got nice and quick support. 3) I love PW and therefore want it to be successful, but I'm personally missing nothing.1 point
-
Tried it out too, works great! Experimenting with selectors I found something that makes me now ask the following question: $results1 = $pages->find("$selector1"); $results2 = $pages->find("$selector2"); $allResults = $results1->import($results2)->sort("-modified")->find("limit=5"); This code works. But if I use the following code, it ignores the second parameter (limit): $allResults = $results1->import($results2)->find("sort=-modified, limit=5"); And if I switch them to find("limit=5, sort=-modified") then sort parameter is ignored. Is it ok?1 point
-
Regarding learning OOP, WillyC actually makes a good point there about something that is kind of helpful in learning it. Thinking about interfaces in code the way you do interfaces with the objects you interact with in real life. Objects are meant to be self contained things that have defined inputs and outputs, hiding the [potentially complex] details of how it happens and just giving you predictable inputs and outputs. If you start relating objects in real life to their equivalent in code, things start to come together a little easier and it gets your mind in the right place. Stepping back from his toilet example and use something like a faucet instead. The inputs are knobs that set the temperature and strength of flow. And the output is water at the temp and flow you set. $faucet = new Faucet(); $faucet->setTemp(97); $faucet->setFlow(10); echo $faucet->render(); (or something like that)1 point
-
1 point
-
Attached is a ZIP containing the all those files if you'd rather drag in the zip or json files rather than paste in each of the names. These originated with my fake-Spanish translation, so several of the files have the Spanish translation, which you'll want to overwrite with your own translations. spanish.zip I will plan to keep the list above and this file up to date as new translated files are added.1 point