Jump to content

FuturShoc

Members
  • Posts

    82
  • Joined

  • Last visited

Everything posted by FuturShoc

  1. I don't, no. I'm even looking at the page source and the caps are not getting applied. :-\
  2. I can see no reason this wouldn't be working, but it isn't capitalizing my page title. <h1><?php echo ucwords($page->title); ?></h1>
  3. Wanze's suggestion is working great for me. And I was able to keep the max execution time on the server set to 30 seconds. Thanks, Wanze!
  4. I'm bootstrapping PW in order to import logins and passwords from an existing text file. It's all working fine, but execution time is taking much longer than it really should. I'm only getting about 180 users generated before it times out. The file contains 1000 entries. (I've broken the original file of about 9000 entries down to 9 smaller files with 1000 entries each.) Yes, I've adjusted my php.ini config to allow up to 180 seconds of execution time, but I'm hesitant to adjust higher since the server holds lots of other productional sites. Is there a better way to generate users in bulk? include("index.php"); $file = file_get_contents("myfile.txt"); $user_array = explode("\n", $file); foreach ($user_array as $user) { $uray = explode(",", $user); $username = strtolower(trim(str_replace(array('@', '.', '_'), '-', $uray[0]))); $u = new User(); $u->name = $username.'xxx'; $u->email = trim($uray[0]); $u->pass = $uray[1]; $u->addRole("parkhill-member"); $u->save(); } echo 'Done.';
  5. Ok, using FireBug's console, I've determined that I've had a malware injection that's showing up in the ajax response for the page listing. But I can't find the file that's screwing up. ... Looks like the best thing to do here is to run a restore of that site on my server from a previous backup. This will give me clean versions of all the files. Thanks, Wanze, for the reminder that Firebug's console is so much more helpful than Safari's default console. Safari wasn't showing me the response, which is where the marlware injection code had been inserted.
  6. I moved my site to a new server. Although the front-end looks fine and is showing the site pages as expected, the PW control panel is not listing the pages. The little arrow animation just sits there. The rest of the PW interface is all there and looks good. It just won't list the pages.
  7. Thanks for everyone's input. I understand now, though I don't think it was unreasonable for me to expect URL segments to begin right after the base url. Now that I understand the expectation, I can certainly use page name to refer to that segment.
  8. Ah, yes, Ryan. That was my expectation. So, UrlSegments in ProcessWire only begin *after* the known page address?
  9. It doesn't work for me, despite the enabled template and $config->maxUrlSegments config entry being set up. Is there any other factor which might prevent it? Ok, I've experimented with adding segments to my page URL and I think I see part of the problem. My development base url is this: http://domain.com/clients/lrpa/web/ My page url which doesn't echo my URL segments as expected is: http://domain.com/clients/lrpa/web/business-industry/ However, if I add another segment, like this... http://inthooz.me/clients/lrpa/web/business-industry/test It recognizes "test" as segment 1. SO, it appears that my base url has too many subdirectories which is interfering with PW's segment variables. Is there anything I can do to counteract this affect?
  10. For the record, I have enabled "Allow URL segments" for that template in PW's control panel.
  11. For some reason, $input->urlSegment1 isn't returning a value. Nor is $input->urlSegment2, $input->urlSegment3, etc. I'm just trying: echo $input->urlSegment1; ... but there *ARE* segments in these positions of the page. For the record, I have enabled "Allow URL segments" for that template in PW's control panel.
  12. Ok, it looks like I had a SECOND $u->save(); later in my code and that's what was throwing this last error. Once I moved that to *before* the image upload code, it does appear things are working now. Thanks for your feedback and help, Wanze.
  13. I just updated the PW installation to the latest dev branch. Here is my code: $upload_path = '/tmp/'; $f = new WireUpload('avatar'); //avatar is the name of the input-file field $f->setMaxFiles(1); $f->setMaxFileSize(5*1024*1024); $f->setOverwrite(false); $f->setDestinationPath($upload_path); $f->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); $files = $f->execute(); if ($f->getErrors()) { foreach($files as $filename) @unlink($upload_path . $filename); foreach($f->getErrors() as $e) echo $e; } else { //Save the foto to the avatar field $u->of(false); $u->avatar = $upload_path . $files[0]; $u->save(); $u->of(true); @unlink($upload_path . $files[0]); } And this is the error: Error: Uncaught exception 'WireException' with message 'Can't save page 41: /processwire/access/users/futurshoc/: Call $page->setOutputFormatting(false) before getting/setting values that will be modified and saved. [ministerpic]' in /home/inthoozm/public_html/dev/pvcc/wire/core/Pages.php:514
  14. Here is the current state of my code: $upload_path = '/tmp/'; $f = new WireUpload('avatar'); //avatar is the name of the input-file field $f->setMaxFiles(1); $f->setMaxFileSize(5*1024*1024); $f->setOverwrite(false); $f->setDestinationPath($upload_path); $f->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); $files = $f->execute(); if ($f->getErrors()) { foreach($files as $filename) @unlink($upload_path . $filename); foreach($f->getErrors() as $e) echo $e; } else { //Save the foto to the avatar field $u->of(false); $u->avatar = $upload_path . $files[0]; $u->save(); $u->of(true); @unlink($upload_path . $files[0]); } and this is the error I'm receiving: Error Uncaught exception 'WireException' with message 'Method WireUpload::setMaxFileSize does not exist or is not callable in this context' i
  15. Here's my actual code: $username = $_POST['username']; $u = wire("users")->get($username); $upload_path = '/tmp/'; $f = new WireUpload('avatar'); //avatar is the name of the input-file field $f->setMaxFiles(1); $f->setMaxFileSize(5*1024*1024); $f->setOverwrite(false); $f->setDestinationPath($upload_path); $f->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); $files = $f->execute(); //Actually not sure if this returns an array if you only allow to upload one file, maybe its the filename (string) if ($f->getErrors()) { foreach($files as $filename) @unlink($upload_path . $filename); foreach($f->getErrors() as $e) echo $e; } else { //Save the foto to the avatar field $f->of(false); $u->avatar = $upload_path . $files[0]; $u->save(); $f->of(true); @unlink($upload_path . $files[0]); }
  16. Thanks for your reply, Wanze. When I implement this approach, I'm getting this error: Error Uncaught exception 'WireException' with message 'Method WireUpload::of does not exist or is not callable in this context' ... Does it matter that I'm bootstrapping PW in my script?
  17. We've home-rolled a front-end profile management page and we've expanded profiles with lots of custom fields. It's working great! Now, I need to allow site members to upload their own profile photo to the default 'avatar' field. Of course, I know how to add a file upload field to the form and work with the file in my target script. But I'm a bit unclear as to how to bridge the gap to populating the avatar field value. Can someone provide a code snippet?
  18. Wow, I don't know how I managed to overlook that. Apologies.
  19. Can someone provide a link to a tutorial about implementing a simple site search in PW? I've dug around here quite a bit tonight and can't seem to find anything. Though I know PW has a $pages->find() method, I'm not finding a how to on the subject...
  20. Thanks for your feedback on this, Ryan. Your active involvement here on the forums is a major factor in my adoption of PW personally and in my day job.
  21. Thanks, Wanze. I hadn't really looked into the files contained in Ryan's "Blog Profile", so I had assumed there was something special about them that made them exclusive. It sounds like your suggestion might be a good way to go. Thanks to everyone for their input.
  22. I can't imagine why any such effort would be "difficult". Every other content management system with any level of adoption has at least one similar module available. Blogs almost always include a handful of standard features: 1. A holder page for a list of links to each entry. 2. A dedicated page for each entry. 3. Optional comments for each blog entry. 4. Common sidebar "widgets" for monthly and yearly archives. 5. Possibly an RSS subscription icon or text link. Pretty standard, no? Of course, it's impossible to be all things to all people. But if that was the goal, no blog module would ever get written.
  23. I have, of course, seen Ryan's excellent "Blog Profile" for ProcessWire. As I understand it, this package serves as a replacement to the default site and assumes blogging is the main purpose of any PW site it's applied to. Great. But at our shop, blogging is almost always just a *part* of what a client site is intended to do. A blog is merely a *section* in a larger site. So, that brings me to my likely need to put together more of a drop-in addition for PW to make it easy to *add* a blog to an existing ProcessWire site. As it happens, I'd really like to do some work in the PW community to help expand PW's overall appeal. Seems to me, a drop-in blog module would be a great place to start. Has anyone else gone this route or had ideas they might want to share? I'm not so much looking for code here. This would be more of a discussion about approach, feasibility, and a wish list for such a module.
×
×
  • Create New...