-
Posts
10,902 -
Joined
-
Last visited
-
Days Won
349
Everything posted by adrian
-
Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML
adrian replied to David Karich's topic in Modules/Plugins
Hi David, Thanks again for a great module. Just wondering if you did any experimenting with other js minification libraries? I am no expert on this, but noticed that I can get significantly smaller files (in one case 400kb down to 300kb) by minifying using http://jscompress.com/ I know that runs on nodejs, but there are other php alternatives out there, although maybe none of them are any better. Maybe you've already been through this process and decided JSMin is the best option, but just thought I'd ask -
What about this: $results = $page->children("limit=2, sort=-date");
- 6 replies
-
- Pagination
- url
-
(and 3 more)
Tagged with:
-
Ok, well you have the allow pagination on the correct template now which is good. I don't really ever use render() for generating page content, so I might be off here, but try this: foreach($results as $result){ echo $result->title . '<br />'; }
- 6 replies
-
- Pagination
- url
-
(and 3 more)
Tagged with:
-
I don't understand why you are doing this: $u = $users->get($user); if (count($u->avatar)){ You have already done a foreach: foreach($user->avatar as $image) { to define $large and $thumb Think about this vs using first() if the avatar field can contain more than one image (although makes sense to set it to one in this scenario I would think). Keep in mind that right now you'd be re-setting the $large and $thumb for each image if there was more than one. But the key thing is that you can check if they are set for your if/else statement. if (!isset($thumb)){ $avatar_thumb .= "this is a test"; } else { $avatar_thumb .= "<img class='img-rounded img-responsive' src='{$thumb->url}'' alt='{$thumb->description}'' />"; } Oh, and definitely try to follow Martijn's suggestion of making your code better formatted before posting, as well as trying to reduce it down to just where the problem is - I know this can sometimes be difficult but it does make it look less overwhelming for those considering helping.
-
Do you have "Allow Page Numbers" turned on for the template? Have you tried: foreach($results as $result){ echo $result->render(); }
- 6 replies
-
- Pagination
- url
-
(and 3 more)
Tagged with:
-
@horst - great job on this - I will try to test soon. One thing I just noticed is that singular is still set to false in the version posted to Github.
-
[SOLVED] LESS CSS on Server without Node.js.................anyone?
adrian replied to Vineet Sawant's topic in Dev Talk
You could also make use of the PW AIOM module: http://modules.processwire.com/modules/all-in-one-minify/ which compiles less on the server automatically. -
This is what I have based my front-end logins off and all work great: https://processwire.com/talk/topic/1716-integrating-a-member-visitor-login-form/?p=15919
-
@isellsoap - I am not a formbuilder user so not sure if this is a bug or not, but your best chance of getting a speedy replay from Ryan is to post this in the Formbuilder support area: https://processwire.com/talk/forum/18-form-builder-support/ If you don't have access to board, you should PM Ryan and ask for access.
-
ProcessWire on Windows7/2008 Server with IIS WebServer
adrian replied to nikola's topic in General Support
Have you read and followed the instructions in post #8 above? Particularly the bit about "Error 404 file or folder". It sounds like you need to download and install a separate url rewrite module. Hope that helps? -
Repeaters: sorting input fields; listing according to input fields
adrian replied to joe_ma's topic in Getting Started
The clue is in the array keys - see how there are lots of the same numbers? Your $days = array(); is inside the $programm loop so it is getting reset each time. Also you are outputting the results inside the $programm loop. Try this. Untested, but I think it should be right. $programm = $pages->find("template=event"); //find all pages with events $days = array(); // array for dates - defined once at the start foreach ($programm as $p) { $events = $p->time_loc; //find the repeater fields foreach ($events as $event) { $days[]= date("l, d. M Y",$event->getUnformatted("date")); //fill the dates array with the dates from the repeater } } //close programm loop $day = array_unique($days); // eliminate duplicate dates asort($day); foreach($day as $key => $d) { echo "<p>$key = $d</p>"; } -
Repeaters: sorting input fields; listing according to input fields
adrian replied to joe_ma's topic in Getting Started
$program = $pages->find will return an array of pages so you need to foreach through that as well. -
In a bit of a rush, but ->get will only ever return one page. You need ->find if you want to get all pages with parent=/products/ So maybe: $all_pages = $pages->find("parent=/products/"); foreach($all_pages as $p){ $p->of(false); $i=0; foreach($p->prod_image as $image){ //if($i!=0) $p->images->delete($image); if($i!=0){ echo $image . " selected to delete<br />"; } $i++; } } Note - really rushed and untested, but hopefully you get the idea.
-
Prevent users to delete pages with certain templates
adrian replied to juhis's topic in General Support
What I do is define a role called "deletor" with permissions to view, edit. and delete. Then for the appropriate templates give the deletor role the ability to edit the page. For those templates that should be edit only, only check edit for the editor role, not the deletor role as well. Does that make sense? -
-
As Ryan states: "The info field (in the page editor settings tab) is currently specific to server time and not affected by timezone settings." https://processwire.com/talk/topic/2846-timezone/?p=38793
-
That makes sense - I thought I must have been missing something Yeah, most fields don't have created/modified db fields. Files/Images fields do - if you look at the DB structure they have both created/modified fields, although interestingly those fields don't exist on a new install - they get added the first time the field is used. So yeah, I think the easiest option would be to create another field to store that.
-
Try this: $p=$pages->get("/mypage/"); $p->of(false); $i=0; foreach($p->images as $image){ if($i!=0) $p->images->delete($image); $i++; } $p->save("images");
-
Maybe I am not getting your point, but I just tested this: $p=$pages->get("/about/"); $p->headline = "test"; $p->of(false); $p->save("headline"); and the page's modified date gets changed, just like it would if you saved the entire page. Are you getting different results, or am I off base on what you are trying to do?
-
Try running this from a template file: $u = $users->get('admin'); // or whatever your username is $u->of(false); $u->pass = 'your-new-password'; $u->save(); to reset your password.
-
It's not fully ready yet, but horst has been working hard on it. He will probably chime in here soon, but you can get a fairly recent version of his work here: https://processwire.com/talk/topic/6096-imagick-resizer-need-tests-for-icc-cms/ Navigate into the site-default/modules folder in the zip and grab the module from there.
-
Sorry about that. I have a quick fix for you. Replace line#113 with this: $videoID = strpos($matches[2][$key],'#') !== false ? strstr($matches[2][$key], '#', true) : $matches[2][$key]; I need to get a more complete fix though because there are other ways to define the start time, but haven't got time right now as I want to check out all the options for vimeo as well. This should get you going in the meantime though.
-
I am guessing you have also seen this module then? http://modules.processwire.com/modules/link-shortener/ Of course this requires manual creation of each shortlink, but thought I'd post it here just in case someone else finds it useful.
-
Hi @Can, Here is another option for automatic shortlinks: http://modules.processwire.com/modules/process-redirect-ids/ It uses the ID of the page, so a link can be as simple as: mysite.com/1034 but as long as the page id is in the url somewhere, it will work, so you can structure the link to be whatever you want really. Not sure if it suits your needs or not, but thought I'd mention it just in case.
-
Hey Nico, not ideal I know, but maybe this workaround would get you going with FieldtypePage fields as well? https://processwire.com/talk/topic/6187-upload-bug-with-image-field-using-inputfield-dependencies/?p=60588