Jump to content

gunter

Members
  • Posts

    76
  • Joined

  • Last visited

Everything posted by gunter

  1. I have a image upload problem! The ajax gif is turning and not stopping... The image and the resized image appears in the assets/file/xxx folder... The image-sizer.txt log file says it has resized the image (I switched debug on) the ajax gif is still turning When I click save... the image isn´t added to the page... :-( It´s an fresh pw installation... And I tried it with several wamp servers (easynews, xampp)
  2. Thanks Adrian, I wrote a save() function for my module... public function save() { // get stored data $data = wire('modules')->getModuleConfigData($this); // populate stored data array with the current data foreach($data as $name => $value) $data[$name]=$this->$name; // save config data wire('modules')->saveModuleConfigData($this, $data); return $data; // or return true or whatever you like } so I can use it in my module like this: //as example storing a GET variable $this->id = $this->wire('input')->get('id'); $this->save();
  3. Is it today still necessary to store a module configuration variable like this? <?php $data = array( 'something' => 'Well hello there', 'something_else' => 1234, ); $module = 'ModuleClassName'; // can also be instance of module wire('modules')->saveModuleConfigData($module, $data); //I can store a new value in the config variable, but it´s not stored... $this->set("module_config_variable","new value"))
  4. thanks for trying to help me (I had problems with composer) The solution was to completely reinstall windows.. And now it works... A small question I have... Is this the correct way to use the GoogleAPI module to retrieve the calendar list? (from within a module) $google = $this->wire('modules')->get('GoogleClientAPI'); $service = new \Google_Service_Calendar($google->getClient()); $calendarList = $service->calendarList->listCalendarList(); foreach ($calendarList->getItems() as $calendarListEntry) { $out.= " <p><a href='../'>".$calendarListEntry->getSummary()."</a></p>"; //dummy code ;-) $out.= $calendarListEntry[id]; $calendarTest = $service->calendarList->get($calendarListEntry->getID()); //echo $calendarTest->getSummary(); }
  5. That would be so nice from you! You other guys could try if it works for you, if you comment out these lines in the code! For me this error is gone... (of course you cannot show your profile...) public function showProfile() { // require_once( "classes/SocialLoginProcessProfile.php" ); // $SocialLoginProcessProfile = new SocialLoginProcessProfile( $this->enabled_profile_user_fields ); // $SocialLoginProcessProfile->process(); } but I have now a google uri mismatch error.. google told me this uri is wrong: http://terminio.at//en/social-login/?hybridauth=login&hauth.done=Google but I added it at my google credentials... I don´t understand why this can be wrong...
  6. Who can help please? This is the problem that I have with Processwire 3.12 and the module SocialLogin... this line does not work! (Error: Class 'ProcessProfile' not found ) class SocialLoginProcessProfile extends ProcessProfile { does it has to do with the new namespace thing in processwire 3.x? <?php namespace ProcessWire; /** * ProcessWire Self Profile * * ProcessWire 3.x (development), Copyright 2015 by Ryan Cramer * https://processwire.com * * * @property array $profileFields Names of fields user is allowed to edit in their profile * */ class ProcessProfile extends Process implements ConfigurableModule, WirePageEditor { public static function getModuleInfo() { return array( 'title' => __('User Profile', __FILE__), // getModuleInfo title 'summary' => __('Enables user to change their password, email address and other settings that you define.', __FILE__), // getModuleInfo summary 'version' => 101, 'permanent' => true, 'permission' => 'profile-edit', ); }
  7. My name is Günter and the module is registering G-nter.... Does anyone has an idea how to get the right formatting with weird letters?< edit: okay, I think I have to use either header('Content-Type: text/html; charset=ISO-8859-1'); or utf8_decode ($name-from-facebook);
  8. I have some problems with composer...the biggest is this:composer require processwire/google-client-api this gave me this error: Problem 1 ....processwire/google-client-api 2.0.0 requires google/apiclient ^2.0.0.RC... no matching package found....
  9. I wanted upgrade from Processwire from 3.0.8 to 3.0.11via the Upgrade Module (0.0.6), but it said: "Unable to locate ZIP: C:/Users/gf/Documents/UwAmp/www/fullpage3/site/assets/cache/ProcessWireUpgrade/devns.zip" but the module downloaded the "wire-3.0.11" folder into the main directory, so I did the upgrade by hand...
  10. I wrote a module that scans the template subfolders for javascript and css files and displays them in a list. Each line has an "open detail" link, when you click it, the path and file gets passed to the sub function (the __executeSomething).... The module sub function displays then the proper code and path.... to the files: (the names of the files are examples) <script src="<?php echo $config->urls->templates?>scripts/jquery-2.2.0.js"></script> or <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>styles/jquery.bxslider.css" /> I found it like this better than to do this by hand... I am trying to get confident with modules, I never used GET parameters but it´s a good idea, thanks... I thought using the url parameter is the way to do this ;-)
  11. ah... Forget to do it like that, I think this should work, thanks Martijn! But I found a solution to do it the way I wanted, in an encoded parameter, it looks a little bit complicated, but it works, I found it at the php documentation at base64_encode at the comments: "Php version of perl's MIME::Base64::URLSafe, that provides an url-safe base64 string encoding/decoding (compatible with python base64's urlsafe methods)" //we are here in a module: public function ___execute() $weblink= "this is the url parameter I want pass! with/my/filepath/file.css"; $weblink = base64_encode($weblink); $weblink = str_replace(array('+','/','='),array('-','_',''),$weblink); $link="<a href='./something/". $weblink."''>open detail</a>"; public function ___executeSomething() { $this->headline('This is something!'); $this->breadcrumb('../', 'Hello'); $url_parameter=wire("input")->urlSegment2; $url_parameter = str_replace(array('-','_'),array('+','/'),$url_parameter); $mod4 = strlen($url_parameter) % 4; if ($mod4) { $url_parameter .= substr('====', $mod4); } $url_parameter=base64_decode($url_parameter); $out = " <h2>".$url_parameter."</h2>"; }
  12. I know how to pass data to my process module function, $text=wire("input")->urlSegment2 works wonderfully... But my data that I want to pass to my function something like this: "/fullpage3/site/templates/scripts/jquery-2.2.0.js" So.. I just can say you.. an url like this does not work... the url parameter cannot have slashes... As I already mentioned, I wanted encode it, but this did not work with the functions I mentioned... What worked was this: str_replace('/', '---', $weblink) but that looks silly..... Ok, Lostkobrakai, GET parameter did work... but I can use it only with echo ($_GET["link"]); and not with echo $input->get['link']; //this does not work...
  13. public function ___executeSomething() { $this->headline('This is something!'); $this->breadcrumb('../', 'Hello'); $url_parameter=wire("input")->urlSegment2; wire("input")->urlSegment2 worked for me for receiving the url data for an url like .....ModuleName/Something/UrlParameter but in my case I had problems to encode/decode my url parameter properly, because urlencode() and base64_encode() did not work properly, so if you know a function to do this, I would be happy..
  14. I am writing a module and want pass a parameter by the url parameter to an "___executeSomething" method, how can I encode and decode something to pass it in the url? The data contains slashes (it´s a path), so I tried urlencode() and base64_decode() but this seems not to work, because somehow the browser seems to decode it by itself.. with urlencode() comes a 404 path not found error... with base64_decode() comes just a blank screen... so what shall I do?
  15. Oh, thanks, it works now!!! I didn´t thought about using return
  16. unfortunately this following code does not work, and I don´t know why... if($config->ajax) { // page was requested from ajax $config->appendTemplateFile = ''; // switching off the _main.php template - but does not work... // then do some ajax post handling here... } I like to use the automatic including of the _main.php, via the config.php... but I want switch it off in my template, when a ajax call is coming... How can I override the setting from the config.php on my page? Is it possible, or do I have to make a separate template for this?
  17. on a Windows machine, localhost... Version 2.4 worked pretty fine, I removed it totally and installed version 2.5 and it did not work - see the errors below! the first error went away after putting this into the config.php $config->protectCSRF = false; $config->sessionChallenge = false; $config->sessionFingerprint = false; and then I installed again 2.4 and this version worked again perfectly... don´t know what to do... When I try to drag and drop a picture into the picture field this error comes: ------"this request was aborted because it appears to be forged." and when I want save a page this error comes: Error: Maximum function nesting level of '100' reached, aborting! (line 113 of C:\EasyPHP\data\localweb\projects\ebay2\wire\core\WireData.php) This error message was shown because you are logged in as a Superuser. Error has been logged.
  18. Hi, I have a question about best practices for my case: I want import events from a google calendar - and I want make calculations with the begin and end time of the event (add a half our.. substract a half our)... which format shall I use for storing the date time? sorry for my asking, I am a little bit lost and the php date is making me a little bit crazy! The google calender uses RFC3339...begin: 2014-03-27T17:00:00.000+01:00end: 2014-03-27T20:00:00.000+01:00
  19. I want to know your opinion, I wrote this small script, it´s not perfect, but it´s very helpful, it outputs php code. I have included it globally at the footer when the develper is logged in, so I can view the code output at all pages... the first snippet outputs code to echo all the fields of the actual page, from the actual page or another one... so if you need somewhere the value of a field you can quickly copy&paste the code... $text=""; foreach($page->fields as $field) { $text .= '<b>'.$field->name.' = '. substr($page->get($field->name), 0, 50).'</b> // name & value &lt?php echo $pages->get("/'.$page->name.'/")->'.$field->name.'; ?> echo from another page &lt?php echo $page->'.$field->name.'; ?> echo from the same page '; } echo "output the fields "; echo "<pre>"; echo $text; echo "</pre>"; example - in my case it outputs this: title = title // name & value <?php echo $pages->get("/hhhhhh/")->title; ?> echo from another page <?php echo $page->title; ?> echo from the same page email = margit.werner@tralala.at // name & value <?php echo $pages->get("/hhhhhh/")->email; ?> echo from another page <?php echo $page->email; ?> echo from the same page kunde_vorname = MargariteMargarite // name & value <?php echo $pages->get("/hhhhhh/")->kunde_vorname; ?> echo from another page <?php echo $page->kunde_vorname; ?> echo from the same page kunde_nachname = Name // name & value <?php echo $pages->get("/hhhhhh/")->kunde_nachname; ?> echo from another page <?php echo $page->kunde_nachname; ?> echo from the same page locations = 1020|1018 // name & value <?php echo $pages->get("/hhhhhh/")->locations; ?> echo from another page <?php echo $page->locations; ?> echo from the same page checkbox = 1 // name & value <?php echo $pages->get("/hhhhhh/")->checkbox; ?> echo from another page <?php echo $page->checkbox; ?> the next snippet echoes the code for the form. it´s simple and it takes no care of the different fieldtypes (and it generates css markup for bootstrap...) Form: <?php echo "<pre>"; $text ='<form action="<?php echo $page->url; ?>/" method="post" accept-charset="UTF-8"> '; foreach($page->fields as $field) { $text.='<div class="form-group"> '; $text.='<label for="'. $field->name.'">'.$field->name.'</label> '; $text.='<input name="'. $field->name.'" class="form-control" value="<?php echo $page->get("'.$field->name.'");?>" /> </div> '; } $text.=' <button type="submit" value="submit" class="btn btn-default" name="submit">Submit</button> </form> </div>'; echo "<pre>"; echo htmlspecialchars($text); echo "</pre>"; in my example page it generates this: <form action="http://localhost/kalender/kunden/<?php echo $page->name; ?>/" method="post" accept-charset="UTF-8"> <div class="form-group"> <label for="title">title</label> <input name="title" class="form-control" value="<?php echo $page->get("title");?>" /> </div> <div class="form-group"> <label for="email">email</label> <input name="email" class="form-control" value="<?php echo $page->get("email");?>" /> </div> <div class="form-group"> <label for="kunde_vorname">kunde_vorname</label> <input name="kunde_vorname" class="form-control" value="<?php echo $page->get("kunde_vorname");?>" /> </div> <div class="form-group"> <label for="kunde_nachname">kunde_nachname</label> <input name="kunde_nachname" class="form-control" value="<?php echo $page->get("kunde_nachname");?>" /> </div> <div class="form-group"> <label for="locations">locations</label> <input name="locations" class="form-control" value="<?php echo $page->get("locations");?>" /> </div> <div class="form-group"> <label for="checkbox">checkbox</label> <input name="checkbox" class="form-control" value="<?php echo $page->get("checkbox");?>" /> </div> <button type="submit" value="submit" class="btn btn-default" name="submit">Submit</button> </form> </div> the third snipped generates code for the form handling... echo 'Form Processing:'; $text ='&lt?php if($input->post->submit) { $page->of(false); '; foreach($page->fields as $field) { $text .=' $page->set("'.$field->name.'", $sanitizer->text($input->post->'.$field->name.')); '; } $text .=' $page->save(); } ?>'; echo "<pre>"; echo $text; echo "</pre>"; at my example page it generates this: <?php if($input->post->submit) { $page->of(false); $page->set("title", $sanitizer->text($input->post->title)); $page->set("email", $sanitizer->text($input->post->email)); $page->set("kunde_vorname", $sanitizer->text($input->post->kunde_vorname)); $page->set("kunde_nachname", $sanitizer->text($input->post->kunde_nachname)); $page->set("locations", $sanitizer->text($input->post->locations)); $page->set("checkbox", $sanitizer->text($input->post->checkbox)); $page->save(); } ?> this is my first code posting, I hope you understand what I am doing and my code isn´t too messy.
  20. hm, thanks a lot!!! ​I changed it to array('') ...and it works now! /** * Installer: HTTP Hosts Whitelist * */ $config->httpHosts = array('localhost');
  21. I have the actual version of pw, I had my pw installation at my localhost and copied 2 days ago everything to my production server, everything ok... but today I noticed that all *view page* links in the admin are showing to my localhost...
  22. Thanks for your great help, guys! Everything is clear now!
  23. oh thanks! great help!!! I have overseen this part of the template admin menu!!!
×
×
  • Create New...