Leaderboard
Popular Content
Showing content with the highest reputation on 11/30/2012 in all areas
-
Well deleting the original will leave you with a problem as you already know It would be relatively easy to script a batch resize all original images and run that once over all page that has images. Use the ImageSizer class. Working example: $pa = $pages->find("template=basic-page,images.count>0"); foreach($pa as $p){ foreach($p->images as $i){ $ImageSizer = new ImageSizer($i->filename); $ImageSizer->resize(120,0); } } It will resize all the original images to 120x*. And you're done. (This particular example show how cool the on-page images are.)5 points
-
Ironically, odds are it's due to a broken regular expression in IPB's code.3 points
-
Wasn't Foundation v2 also responsive? I've not checked out 320andup yet, but am going to take a closer look today. And this gridpak generator looks pretty awesome. great links. I think mobile-first sounds like a great slogan but not a great strategy. It's easy to identify sites that have taken that strategy because the non-mobile version of the site often seems like… an enlarged mobile site. I've not done a lot of mobile stuff yet, but with what I've done, I prefer to focus on both at the same time. Otherwise it seems like sacrifices are being made to one or the other. The full-size design is still what I ultimately have to sell to the clients. There's fewer variables on the mobile side in terms of design and that part [so far] seems a lot simpler to account for (and easier to get approved too). So I guess I think the picture should be bigger than just mobile first. Sorry, maybe I'm a bit off topic, but just remembering an overabundance of mobile first hype at an AEA event last year.2 points
-
The only way I see to do this in a find with a selector, is to do something like this: $up_pages = $pages->find("status=unpublished"); $sel = ''; foreach($up_pages as $p){ $sel .= ",has_parent!=$p->id"; } $pa = $pages->find("template=basic-page$sel"); foreach($pa as $p){ echo "<p>page: $p->title $p->url</p>"; }2 points
-
The key to a lot of this sort of thing is automatically and cleverly linking people and ideas together. So, if someone posts an image to a time line, another person can either comment or link to another part of a timeline. History, community history in particular, is not just vertical, it is horizontal, and that is where the most interesting bits can be. By the way, you chaps might find these interesting: http://timeline.verite.co/ http://tympanus.net/Tutorials/LateralonscrollSliding/ http://timeglider.com/widget/index.php Joss2 points
-
2 points
-
Hi @antknight, great to see a newer face on the forum so firstly: welcome! As with most things PW, the answer is almost certainly "yes" but in this case you'd probably be compromising the permissions on your template & css files in order to do it. I know that some other CMSs do have this kind of feature though (like Textpattern, which I like a lot.) Can I ask what your rationale for the request is? Do you need to develop on a live server or something? It might be that mounting the server partition locally over SSH would be both faster and more secure in such cases.2 points
-
What does autojoin do? Using the 'autojoin' optimization can increase performance on fields that get used a lot. Not using it can reduce the page's memory footprint. What is more desirable in each instance depends on your situation. What sites should use autojoin? Autojoin is most applicable with larger sites. On smaller sites, there may be no benefit to using it or not using it. But it's good to know what it's for regardless. Where do you control autojoin? Autojoin is controlled per-field. You can turn it on by editing each field under Setup > Fields > [your field], and you'll see it under the 'Advanced' heading. When should you use autojoin? Autojoin causes the field's data to be loaded automatically with the page, whether you use it or not. This is an optimization for fields that you know will be used most of the time. Fields having their data loaded with the page can increase performance because ProcessWire grabs that data in the same query that it grabs the Page. Autojoin is a benefit for fields that are always used with the Page. This is best explained by an example. Lets say that you have a template for individual news stories called news_story. The news_story template has these fields: title date summary body sidebar We'll assume that when you view a page using the news_story template, all of the fields above are displayed. Fields that should have autojoin ON: Now consider a separate news_index template that displays ALL of the news stories together and links to them. But it only displays these fields from each news story: title* date summary In this case, the 3 fields above would be good to autojoin since they are used on both the news_index and news_story templates. If your title, date and summary fields didn't have autojoin turned on, then ProcessWire wouldn't go retrieve the value from the database until you asked for it it (via $page->summary, for example). Because the news_index template displays all the stories at once, and always uses the title, date and summary fields, it will perform better with title, date and summary having autojoin ON than with it OFF. In this case, it reduces the query load of the news_index template by 3 for each news story. To take that further, if it were displaying 20 news stories, that would mean 60 fewer queries, which could be significant. Fields that should have autojoin OFF: Now lets consider the body and sidebar fields, which are only used on the news_story template: body sidebar It would be desirable to leave autojoin OFF on those fields because there is no reason for the body and sidebar to be taking up space in memory when they are never used on the news_index template. While it might mean 2 fewer queries to view a news story, that is not significant and certainly not a worthwhile tradeoff for the increased memory footprint on the news_index template. Keeping autojoin OFF reduces a page's memory footprint. Conclusion Using the 'autojoin' optimization can increase performance on fields that get used a lot. Not using it can reduce the page's memory footprint. What is more desirable in each instance depends on your situation. But if your situation doesn't involve lots of pages or data, then you don't need to consider autojoin at all (and can generally just leave it off). Additional Notes Not all fields have autojoin capability. You won't see the option listed on fields that don't have the capability. *The title field has autojoin on by default, so you don't need to consider that one. It was included in the examples above because I thought it's omission might cause more confusion than it's inclusion. Be careful with multi-value fields that offer autojoin capability (page references and images, for example). Because MySQL limits the combined length of multiple values returned from a group in 1 query, autojoin will fail on multi-value fields that contain lots of values (combined length exceeding 1024 characters). If you experience strange behavior from a multi-value field that has autojoin ON, turn it OFF. If you want to play it safe, then don't use autojoin on multi-value fields like page references and images.1 point
-
Greetings, I'm curious about how those of us go back a ways have some very old built-in habits, tendencies, practices, etc., and how this affects you when coding. Brief Personal History: I learned "programming" on TRS-80s in 1980, when my forward-thinking 8th-grade science teacher obtained a bunch of them for our class. He also ran an after-school workshop on learning computer programming (BASIC), which I attended with great excitement. I also did my first programming in the early to mid-1980s using Apple IIs for my uncle, an accountant who wanted what we'd today call "apps" to automate calculations. That same uncle bought me a Timex Sinclair for Christmas in 1982, which I still own. I'm happy I was introduced to coding so early in life. But sometimes, I find that the ideas from those days stick, perhaps too much. Just one example... When I learned BASIC (don't laugh), a bit of code with conditionals looked something like this: ... 30 IF Y$ = "Y" OR Y$ = "y" THEN GOTO 115 ... 115 PRINT "Thanks man!" But today, in PHP, to test for a condition, it works like this: if($page->images) { /* Do something here that would be true if there are images in the "images" field */ } else /* Do something here that would be true if there are no images in the "images" field */ } In the above example, a lot of the PHP conditional statement is assumed. In the old days, we had to spell it out and send someone to a particular spot in the code. Obviously, no one in his/her right mind would want to go back to the old days! But because of ingrained ideas, I find myself mentally expecting the "then" in the initial conditional statement when it's not necessary. It's a simple thing, but it causes moments of pause. There are lots of other examples beyond simple conditionals. Just wondering, does anyone else here with a similar history feel the same effects? Thanks, Matthew1 point
-
Hiya gang! [waves and slaps some High Fives to those nearest to me] My current client wants to go responsive on his website. I built it earlier this year using Foundation 2.x. Now that v.3 is responsive, I thought I might give it a much needed upgrade. While going through my files I noticed that I didn't use much of the framework. Only the grid, the modal (Reveal) and the slideshow thingee (Orbit). So I was thinking ... hhhmmm ... instead of upgrading Foundation 2 to 3 ... I'd really like to give 320andup a shot. And since it doesn't use any grids, I may use the the gridpak generator, or just take what I need from Foundation. I've grown quite fond of their layout (div.row>div.columns). OR It just may be easier to use Skeleton for the grid (I don't really like having to use 'alpha & omega'). FlexiSlider or BlueBerry for the slideshow. Reveal is available stand-alone, but I really want to minimize my dependence on too much javascript. I've seen several nice HTML5/CSS3 based modals around.1 point
-
Would it be possible to have a module that allowed editing the actual page templates and css etc from the admin? Perhaps using something like http://ace.ajax.org/ That would be sweet!1 point
-
Conveniently CKeditor 4 just came out on the 27th (and with many huge improvements). I started playing around with creating a Module the very next night, I've so far setup some basic config options and got the basics working but a quick look at the custom PW Image and Link plugins for TinyMCE had my head spinning. Maybe if Ryan could shed some light on how these operate or the requirements involved I could make some more progress. I'd really love to see CKeditor replace TinyMCE, even if only for the improved interface.1 point
-
And there my first real module: https://github.com/arjenblokzijl/ProcessPagePathCopy The origin A client needed to copy a lot of handpicked pages. You can do it using "view" and rightclick, but I thaught a single click might be a bit easier. So I wrote (thanks to Soma) this little module which adds a "copy path" action. You can also select a prefix or select which template(s) the actions should be applied to. The client can use command/ctrl + c, switch to his e-mail, do command/ctrl - v, switch back press enter to continue to the next. I need to implement a flash based solution to make the last step redundant. Hopefully that is done the next couple of days.1 point
-
Really? I sometimes need one of those .... Edit: Well, at least it is related. In real life I was a sound engineer and dubbing mixer for 25 years (with lots of copywriting and padvertisign thrown in) and been a composer for the last 10 - I do things like this: https://www.youtube.com/watch?v=ISaXZ5j6gv8&list=PLF9DEA78045F0988C&index=6&feature=plcp But I don't get a lot of call for commissioned music on websites. Pity, audio is really rubbish on the internet - very underused.1 point
-
So as per https://twitter.com/...397667160604672 I wanted to set up PW to manage content inside another web app and I'm doing something similar: require(__DIR__ . '/index.php'); // this is the ProcessWire index file for bootstrap echo $wire->pages->get('/videos')->setOutputFormatting(true)->render(); echo "\n\n\n\n\n==============================\n\n\n\n\n\n"; echo $wire->pages->get('/people')->setOutputFormatting(true)->render(); The problem here is that the first page (videos) renders fine, but the second one (people) does not. Specifically, $page seems to be undefined in the template for "people". If I reverse the order (first render "people", then "videos") then again, the first one renders fine, but the second does not. So I get "people" correctly, but "videos" is stunted because $page is NULL in the template. Any ideas?1 point
-
Now that you mention it, I think that I did have a similar experience a while back. My first exposure to coding was also in BASIC, I think back on old Apple ][e computers. Actually it seemed like we used some language called LOGO back in 2nd grade, where the whole purpose is to make a turtle move around the screen, but can't remember exactly. Even BASIC has come a long way since then (with VB). To me the "GOTO 115" type statements also seem reminiscent of Assembler or COBOL.1 point
-
I was able to reproduce this in a repeater and tracked down a problem (and think I fixed it). Thanks for finding it. This problem would also affect any pages with images that didn't have a template file. Do you want to try the latest dev branch. Or if you are already up to date minus the latest commit, you can replace just /wire/modules/Process/ProcessPageView.module https://github.com/ryancramerdesign/ProcessWire/commit/e000252a264f35deccb081e995a40df451f82952 https://raw.github.com/ryancramerdesign/ProcessWire/e000252a264f35deccb081e995a40df451f82952/wire/modules/Process/ProcessPageView.module1 point
-
Greetings, Well, I think we have come upon a great concept here. Not just the actual concept of creating a community site -- but also the concept of a public, collaborative approach to building a profile. As Joss said, we can use this thread to hash out ideas and questions. Let it be messy! That's OK, since this is both a way to produce something, and to learn. Even though Joss, NooseLadder, and I are all relatively new at ProcessWire, we have all been around the block a few times with PHP, CMSs, and working with clients. Along the way, "Hero Members" can jump in with a pointer or two. In the end, we'll have a working profile, the involved parties will have learned a lot, and we will have a thread that illustrates what is possible in this community. Maybe we can even make this a model for future concepts? I'll be able to start putting some bits together next week. This is great! Thanks, Matthew1 point
-
DOn't know why it is like this, but it seems to have to do with PW getting the previous page, as if using it in a template. In your case there's no "page". I can get it to work when I call $wire->setFuel("page",$p1); after first page rendered. echo $p1 = $wire->pages->get('/videos')->setOutputFormatting(true)->render(); $wire->setFuel("page",$p1); echo $wire->pages->get('/people')->setOutputFormatting(true)->render();1 point
-
What I meant is that I always use Textile to preserve the styling of the website. I don't prefer a WYSIWYG because it brings the best above in people. That's why when it comes to editing web text I'm a strong believer in Textile (or Markdown).1 point
-
I usually do this by hand. Since I'm working more and more like the blog profile (to keep markup as seperated as I can from logic) my template and markup files are this day really small. So tidying it up by hand it pretty easy.1 point
-
Greetings NooseLadder, Sounds interesting! I'm also "cooncepting" some similar ideas. For example, I live in a very active arts community, and I want to let people post images, descriptions, and addresses of their exhibitions. If you get going on this and would like to collaborate, let me know. Maybe we can share some ideas -- or even develop a ProcessWire profile to share with the community? I'm still fairly new here, but I already can see that this sort of concept would be fun to implement with ProcessWire. My main effort right now is learning to build entry forms for "regular" visitors to submit stories. Keep us posted on your progress. Thanks, Matthew1 point
-
Not an easy one, as url isn't hookable in this case. And it also wouldn't be the right place. Since if there's no image ... $page->image will not be an object to start with. But you could make a module function that you use to output images and do your checks there and return a blank.jpg or whatever if there's no image(s). // autoload module public function init(){ // add $this->page->addHook("renderImage", $this, "renderImage"); } public function renderImage($event){ $page = $event->object(); $imagefield = $event->arguments[0]; if($page->template == "admin") return; if($page->$imagefield) return "<img src='{$page->$imagefield->url}'/>"; return "<img src='{$this->config->urls->templates}img/noimage.gif'/>"; } Then use it echo $page->renderImage("image"); Or just use an include function.php, as Ryan suggested in the other thread to do such things.1 point
-
On the face of, this shouldn't be too tricky. Each 'event' (which can be a page with or without a template, depending whether you want to show it as a standalone page from a link on the timeline) will need a date field and then you can order them by date. So you'd build the timeline something like this $events = $pages->find('template=event,sort=-date'); foreach($events as $event){ ...echo whatever you need }1 point
-
If those pages don't have a template file, you could check for the existence of the file foreach($parents as $parent) { if(file exists) //echo link } or you can use the same template for all the section pages foreach($parents as $parent) { if($parent->template != "section") //echo link } or create a global field (available in all templates) from type checkbox, and check it on the section pages foreach($parents as $parent) { if($parent->section = 0) //echo link <-- EDIT: I changed from 1 to 0 here }1 point
-
I and a friend used to sit in the office looking at all the book titles trying to work out difficult to guess passwords that were easy to remember. I asked my mother if she had any suggestions. She worked on the Ultra Secret during WW2 (look it up) so I was interested in her take. She made one little suggestion, so I tried it on my friend who was a bit of a hacking genius. He tried for three days and failed miserably. He gave up and said "okay, what is the password?" "There isn't one," I said. "That was her suggestion." She did the same trick with coding. She was talking to some students about how they worked with the Tipex and Engima machines and about simple codes. "Try this one," she suggested. "I like cream cakes." They battled for days trying to break it, before she gave the solution, which was "I like cream cakes." The lesson: before you waste hours trying to break a code, make sure it is actually a code in the first place! Apparently, that was a serious lesson back in the war. You had to be certain something was a code before you wasted many, many valuable hours. Joss1 point
-
There's also "possessive quantifiers" and "illogical shift upwards". Oops, scratch the last one, that's a machine code mnemonic a bit like "halt and catch fire".1 point
-
Atomic Grouping http://www.regular-expressions.info/atomic.html Negative Lookbehind (and family) http://www.regular-expressions.info1 point
-
Hi, http://kudlek.com/ this is my second project with PW and one I like in particular. I made this side in Textpattern but migrated it as my client wasn't happy with what he got from TXP (and me neither). There is nothing very special on this site but some gimmicks needed my attention such as the exhibitions archive. I enjoyed it very much to work with PW and the endless flexibility it has to offer. There were no limits. My client is very happy with the system. I have Ergo admin theme installed. Best, Christoph1 point
-
...and that would be the way to do it. Or maybe configurable palette of buttons, but I for one (for instance) don't want to have four buttons on my edit page.1 point
-
For those that wanted field/template categorization, I've got them implemented for fields and now development the same for templates. This is one of those features that don't take effect until you use it. The hope is that it won't add any complexity for those that don't need it. There is now a "tags" field on the 'advanced' menu of any field: You can populate that field with one or more tags. Read the description in the screenshot. When you populate that tags field, suddenly the fields list starts grouping them by tag, like this: You can make a tag group appear collapsed by default by prepending a "-" to the tag. Any field can have multiple tags. It'll appear in as many groups as it's defined in. This isn't yet on the dev branch -- I will push it tomorrow after finishing up the Template tags. Can anyone else duplicate in 2.2.10 dev branch, DB session support module installed? I've never been able to duplicate it, but followed the official instructions on the solution to this issue so afraid to change much more until it's repeatable.1 point
-
Do you want to build a form to edit data on a page or is it on another page? Is it possibly a PW user? So it's not the "page" you're looking at, like in the admin backend edit screen? In this case you could load the edit screen of PW with /processwire/page/edit/?id=$page->id and add a &modal=1. If you load that edit link using fancybox iframe feature you get something like adminbar module. So if you enter /processwire/page/edit/?id=1&modal=1 you'll get the edit form without the layout around. Of course this is only for trusted users, as you could remove the param and edit other things like publish, hidden etc. But it's a nice alternative to edit pages data without leaving the frontend page. But if you are wanting a community user to edit his "profile data", which isn't necessary on the page he's viewing or only part and you will code a form to edit the data he can, you simply make a file with the view profile and for edit profile. In your page template for the profile you then simply include one or the other depending on the url segment. Or make the two views they're own physical page. Kinda obvious it would look like this with segments and include. if(count($input->urlSegments) == 0){ include("view_profile.php"); } else if($input->urlSegment1 == 'edit'){ include("edit_profile.php"); } In a edit template to edit profile user data, I for example do something like this: if($user->isLoggedin() && $user->hasRole('beratung-user')) { // logged in $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'profil-form'); $field = $modules->get("InputfieldText"); $field->label = "Last Name"; $field->attr('id+name','last_name'); $field->required = 1; $field->value = $user->last_name; $form->append($field); $field = $modules->get("InputfieldText"); $field->label = "First Name"; $field->attr('id+name','first_name'); $field->required = 1; $field->value = $user->first_name; $form->append($field); $field = $modules->get("InputfieldEmail"); $field->label = "E-Mail"; $field->attr('id+name','email'); $field->required = 1; $field->value = $user->email; $form->append($field); $field = $modules->get("InputfieldText"); $field->label = "Username"; $field->attr('id+name','name'); $field->required = 1; $field->value = $user->name; $form->append($field); $field = $modules->get("InputfieldPassword"); $field->label = "Password"; $field->attr("id+name","pass"); $form->append($field); $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Save"); $submit->attr("id+name","submit"); $form->append($submit); // process form if($input->post->submit) { $form->processInput($input->post); if(!$form->getErrors()){ $user->of(false); // outputformatting off $user->name = $sanitizer->username($input->post->name); $user->first_name = $sanitizer->text($input->post->first_name); $user->last_name = $sanitizer->text($input->post->last_name); if($input->post->pass; != ''){ $user->pass = $input->post->pass;; } $user->email = $sanitizer->email($input->post->email); $user->save(); $user->of(true); // outputformatting on $session->message("Profile saved"); $session->redirect("./"); // redirect to get rid of double post when refreshing } else { // error message are already added by form->processInput() call } } $out .= $form->render(); } else { $out .= "<p>You don't have permission to view this page.</p>"; } ?> <section class="clearfix"> <h1>Edit your Profile</h1> <?php if(count($notices)) include($config->paths->templates . "inc/notices.inc"); ?> <?php echo $out; ?> </section>1 point
-
1 point