Jump to content

peterb

Members
  • Posts

    51
  • Joined

  • Last visited

Everything posted by peterb

  1. thankyou Diogo, There were 3 functions in LanguageFunctions.php that were the culpret... by wrapping them as you suggested made everthing work again.. thanks.
  2. I am in the process of upgrading a processwire site from 2.0 to 2.2, and have found that where I was once able to bootstrap, I am no longer. I am calling processwire from a wordpress install, and this used to work in 2.0 include("./pw/index.php"); // bootstrap ProcessWire $client = $wire->pages->find("template=client, client_email=$email")->first(); now in 2.2 this fails, and I get error like this: [error] PHP Fatal error: Cannot redeclare __() (previously declared in /var/www/vhosts/dev.sitename.com/httpdocs/wp-includes/l10n.php:96) in /var/www/vhosts/sitename.mysite.com/httpdocs/pw/wire/core/LanguageFunctions.php on line 38, referer: http://dev.sitename.com/markets-served/overview/ which seems to colide with a wordpress function: function __( $text, $domain = 'default' ) { return translate( $text, $domain ); } Not really versed enough to go much farther than this... does anyone know a remedy? thanks, Peter
  3. adding title field solved, thanks... how I made templates without them, I do not know... pb
  4. ok, when I remove "Allowed template(s) for children" and save, the error goes away, but as soon as I re-add it, the error returns... only the top level template has a title field, but I can't delete it, as it says: Field "title" may not be removed because it is globally required by all fieldgroups is there anything else I can flush out or reset?
  5. I thought my upgrade was all set, but I get the following error when I try to add a new page... Error Call to undefined method stdClass::getInputfield() (line 171 of /var/www/vhosts/mysite.com/httpdocs/pw2/wire/modules/Process/ProcessPageAdd/ProcessPageAdd.module)
  6. thanks, that seemed to take care of it... at first the email field was not there, just name and roles. then I went to fields, and turned the filter to show built-in fields, and then the email field showed up over in process > users. thankyou! pb
  7. indeed, here is the code with validation if(isset($_POST['title'])) { $newpage = new Page(); $newpage->template = $templates->get("upload"); $newpage->parent = $pages->get("/uploader-test/"); $newpage->name = $_POST['title']; $newpage->title = $_POST['title']; $newpage->save(); $path=$newpage->images->path; // GET THE PATH TO THE UPLOADS FOLDER FOR NEW PAGE $name = strtolower($sanitizer->name($_FILES['upload']['name'])); // RUN THE $NAME THROUGH $SANITIZER TO MAKE IT PW COMPATIBLE... // prepend underscores to filename until it's unique... while(is_file($path . $name)) $name = "_" . $name; // validate the file extension $pos = strrpos($name, "."); if(!$pos) throw new WireException("File is missing extension"); $ext = substr($name, $pos+1); if(!in_array($ext, array('pdf', 'jpg', 'jpeg', 'gif', 'png'))) throw new WireException("Invalid extension"); $file = $path . $name; // DETERMINE THE FINAL DESTINATION AND STORE IT IN $FILE if(move_uploaded_file($_FILES['upload']['tmp_name'], $file)) { // MOVE THE FILE TO IT'S DESTINATION USING PHP'S FUNCTION $newpage->report_request->add($file); // ADD IT TO THE PAGE $newpage->save(); // SAVE THE PAGE AGAIN } }
  8. thanks.. this seems to work.... if(isset($_POST['title'])) { $newpage = new Page(); $newpage->template = $templates->get("upload"); $newpage->parent = $pages->get("/uploader-test/"); $newpage->name = $_POST['title']; $newpage->title = $_POST['title']; $newpage->save(); $path=$newpage->images->path; // GET THE PATH TO THE UPLOADS FOLDER FOR NEW PAGE $name = strtolower($sanitizer->name($_FILES['upload']['name'])); // RUN THE $NAME THROUGH $SANITIZER TO MAKE IT PW COMPATIBLE... $file = $path . $name; // DETERMINE THE FINAL DESTINATION AND STORE IT IN $FILE if(move_uploaded_file($_FILES['upload']['tmp_name'], $file)) { // MOVE THE FILE TO IT'S DESTINATION USING PHP'S FUNCTION $newpage->report_request->add($file); // ADD IT TO THE PAGE $newpage->save(); // SAVE THE PAGE AGAIN } }
  9. just upgraded from 2.0 to 2.2.. all seems well, except in the admin: 1. the ACCESS -> USERS page produces error: Error Call to a member function get() on a non-object (line 93 of /var/www/vhosts/mysite/pw2/wire/modules/Process/ProcessPageType/ProcessPageType.module)
  10. I have a site page, outside the admin with a form. The form uploads a file which then needs to be inserted into a pw File field. Is this possible using the processwire api? if(isset($_POST['title'])) { // Process the form echo "processed... <br>"; $newpage = new Page(); $newpage->template = $templates->get("upload"); $newpage->parent = $pages->get("/uploader-test/"); $newpage->name = $_POST['title']; $newpage->title = $_POST['title']; $newpage->save(); $newpage->file->add( $_POST['upload'] ); // this throws an error - [color=#000000][font=Times][size=1]Exception: Item added to Pagefiles is not an allowed type (in httpdocs/pw/wire/core/Array.php line 142)[/size][/font][/color] $newpage->save(); } ?> <h1>Upload file...</h1> <form action="" method="post" enctype="multipart/form-data"> <input name="id" value="<?=$page->id?>" type="hidden"> <table> <tr><td>File:</td> <td><input name="upload" id="upload" type="file"></td></tr> <tr><td>Title:</td> <td><input type="text" name="title"></td></tr> </table> <input type="submit" value="NEXT" class="subbut"> </form>
  11. I have an existing pw website that needs some phase 2 additions. Looking for someone versed in processwire to hire & work with. Please contact peter@peterbelsky.com thanks..
  12. thanks ryan, yes, I changed it to just assets, and all is good.
  13. got it working, was a permisions issue. screen shot attached of how I changed the permissions.
  14. just moved a site to a dedicated server. now when I log in, it goes to the site home page, not the admin home page? nothing I do seems to let me get back to the admin???
  15. thankyou, works very well
  16. no that fails also... I was not using the description field, but I guess I could populate it with the text of the file name.
  17. the problem field is a type "File"
  18. thanks, that helped, and now this works $results = $page->children("report_color~=$s, limit=15, sort=$sort "); however is does not work when I am include a page field "report_file": $results = $page->children("report_color|report_style|report_file~=$s, limit=15, sort=$sort "); the page field does work however, without the "~"
  19. thanks ryan, Any idea why this works: $results = $page->children("report_color|report_style|report_file=$s, limit=15, sort=$sort "); finds all entries that are just "white" But this does not?: $results = $page->children("report_color|report_style|report_file~=$s, limit=15, sort=$sort "); finds nothing??? I am searching for "white", and want to find data that also contains "white/blue"
  20. A wildcard for Selector operators would be nice...
  21. I am doing this now, with 5,000 pages & hitting memory limits? $reports = $pages->find("template=report"); foreach($reports as $r) { $r->setOutputFormatting(false); $r->report_status_select = "12576"; wire('pages')->uncacheAll(); $r->save();
  22. here is a snippet that helped me convert a text field to a page field... page fields are the only way currently to have select boxes in the admin. — I had a text field called client_status on a "client" page template that contained one of 2 values, "good" or "expired" — created a page in admin named "status". — then create 2 pages as children of the status page... there titles were "good" "expired" — next, create a new page field called "client_status_select" and added to the "client" page template — then make a page template called "update-clients". with the code below. — lastly, create a page with the "update-clients" template & view it to run the script $clients = $pages->find("template=client"); foreach($clients as $c) { echo "<li>{$c->url}---{$c->client_status}---{$c->client_status_select}</li>"; $selectpage = $pages->get("template=admin, title=$c->client_status"); echo "<li>{$selectpage->id}---{$selectpage->title}</li>"; $c->setOutputFormatting(false); $c->client_status_select = $selectpage->id; $c->save();
  23. tested $session->logout() on mac firefox & chrome, works as expected. In safari, while it does log user out, it does not allow user to re-visit a login page (a page where role is set to "guest") The user who is logging in & out has a role with only "ProcessPageView" checked.
×
×
  • Create New...