Jump to content

flydev

Members
  • Posts

    1,364
  • Joined

  • Last visited

  • Days Won

    49

Everything posted by flydev

  1. Try the following : Put ajax.php file in the root directory : - root_dir - wire - site - index.php - ajax.php then bootstrap ProcessWire (write in ajax.php, at the beginning of the file) : include('./index.php'); and in your javascript code, write the correct path : [...] url: "/ajax.php", [...]
  2. Without the namespace, this error is triggered : Session: error setting certificate verify locations: CAfile: [...]\site\assets\cache\FileCompiler\site\modules\PublishToTwitter\TwitterOAuth\Abraham\TwitterOAuth\cacert.pem CApath: none In TwitterOAuth.php line 353: CURLOPT_CAINFO => __DIR__ . DIRECTORY_SEPARATOR . 'cacert.pem',
  3. To get the module working out of the box on ProcessWire 3.0.x, just add to PublishToTwitter.module before installing it : namespace ProcessWire; Just tested this morning, it works like a charm
  4. Read this @mel47 : https://processwire.com/docs/tutorials/how-to-use-url-segments/ And you can find the wiki url under archive.org : https://web.archive.org/web/20150422040149/http://wiki.processwire.com/index.php/URL_Segments_in_category_tree_example An interesting thread:
  5. So /site/ should be renamed to /enjoy/
  6. I am trying to get a simple button working on Safari/601.1 (iPhone 6) without success, someone got it working on mobile device ? <button id='validate' ic-post-to='{$config->urls->httpRoot}contact_form.php' ic-target='#contact-wrapper' ic-indicator='#indicator'>SEND <i id='indicator' class='fa fa-spinner fa-spin' style='display:none'></i></button> edit: by visiting the official examples on their website, it works edit2: Something weird - it works if I hardcode the url of ic-post-to instead of using $config->urls->httpRoot
  7. You could try my module MarkupGoogleRecaptcha or implement an honeypot field like in the SimpleContactForm module.
  8. I did a test on a fresh install and it work fine. How did you implemented it ? The tree Result with $maxDepth = 1 Result with $maxDepth = 2
  9. Instead of echo $output, you must return the variable and in your template, you echo your function. in _func.php you have your function : function basicPage(){ // ... return $output; } and in your template file you call the function : <?php $out = basicPage(); echo $out;
  10. @Marcel Epp You could add a new parameter to the function. Assuming you are using the code shown in the first post, the following code should work (not tested) : function renderChildrenOf($pa, $maxDepth = 1, $output = '', $level = 0) // MODIFIED_CODE { $output = ''; $level++; foreach ($pa as $child) { $atoggle = ''; $class = ''; if ($child->numChildren(true) && count($child->parents) == 1) { $class .= 'dropdown'; $atoggle .= ' class="dropdown-toggle" data-toggle="dropdown"'; } else if ($child->numChildren(true) && count($child->parents) > 1 ) { $class .= ($maxDepth > 0) ? 'dropdown-submenu' : ''; // MODIFIED_CODE $atoggle .= ($maxDepth > 0) ? ' class="dropdown-toggle"' : ' '; // MODIFIED_CODE } else if ($child->numChildren(true) && $child->id != 1) { $class .= 'dropdown-menu'; } // Makes the current page and it's top level parent add an active class $class .= ($child === wire("page") || $child === wire("page")->rootParent) ? " active" : ''; $class = strlen($class) ? " class='" . trim($class) . "'" : ''; if ($child->numChildren(true) && count($child->parents) == 1) { // Add Caret if have children $output .= "<li$class><a href='$child->url'$atoggle>$child->title <b class='caret'></b></a>"; } else if ($child->numChildren(true) && count($child->parents) > 1) { $output .= "<li$class><a tabindex='-1' href='$child->url'$atoggle>$child->title</a>"; } else { $output .= "<li$class><a href='$child->url'$atoggle>$child->title</a>"; } // If this child is itself a parent and not the root page, then render it's children in their own menu too... if ($child->numChildren(true) && $child->id != 1 && $maxDepth > 0) { // MODIFIED_CODE $maxDepth--; // MODIFIED_CODE $output .= renderChildrenOf($child->children, $maxDepth, $output, $level); // MODIFIED_CODE } $output .= '</li>'; } $outerclass = ($level == 1) ? "nav navbar-nav" : 'dropdown-menu'; return "<ul class='$outerclass'>$output</ul>"; } // bundle up the first level pages and prepend the root home page $homepage = $pages->get(1); $pa = $homepage->children; $pa = $pa->prepend($homepage); // Set the ball rolling... echo renderChildrenOf($pa); Search the comments MODIFIED_CODE to see whats going on in the function.
  11. @csaeumIf you install ProcessWire multi-language support, it should work @Can maybe this small check could help, on line 78/79 if($this->wire('modules')->isInstalled('ProcessLanguage')) { $userLanguage = $this->wire('user')->language; $lang = $userLanguage->isDefault() ? '' : "__$userLanguage->id"; } else { $lang = ''; }
  12. @Kemal, just download the module from the forked version of @ukyo and install it.
  13. @pwired I think he use jquery.waypoints.js to know when he is reaching an element and show the picture by using CSS transitions. Nice job .
  14. ok I see the shade.. shame superslide does not support thumbnails, I worked with a few times, it's a great plugin.
  15. Have a look at http://sachinchoolur.github.io/lightGallery/demos/ It support thumbnails on fullscreen and fullscreen by click + other nice features
  16. You could write a beginner module about Fieldtype/Inputfield which accept a simple text, save it and render its markup . As Horst said, nice initiative !
  17. Hi @kibod , glad you like it and choose it as project starter. And yes in this profile you can have the first parent as menu, clickable.
  18. MarkupGoogleRecaptcha Google reCAPTCHA for ProcessWire. This module simply adds reCAPTCHA V2 or Invisible reCAPTCHA to your form. How To Install Download the zip file at Github or from the modules repository Drop the module files in /site/modules/MarkupGoogleRecaptcha In your admin, click Modules > Refresh Click "install" for "MarkupGoogleRecaptcha" Official install/uninstall doc: http://modules.processwire.com/install-uninstall/ API You must create an API key prior to use this module. Goto https://www.google.com/recaptcha/admin to create your own. Next, add the API keys information to the module's settings. Usage Call the module : $captcha = $modules->get("MarkupGoogleRecaptcha"); Call $captcha->getScript(); somewhere to get the javascript used by reCAPTCHA Render reCAPTCHA in a standard HTML <form></form> by calling $captcha->render() or Render reCAPTCHA in an InputfieldForm by passing as argument your form to the render function: $captcha->render($form) Call verifyResponse() to get the result. It return TRUE if the challenge was successful. Example Using ProcessWire's form API : $out = ''; $captcha = $modules->get("MarkupGoogleRecaptcha"); // if submitted, check response if ($captcha->verifyResponse() === true) { $out .= "Hi " . $input->post["name"].", thanks for submitting the form!"; } else { $form = $modules->get("InputfieldForm"); $form->action = $page->url; $form->method = "post"; $form->attr("id+name", "form"); $field = $this->modules->get('InputfieldText'); $field->name = "name"; $field->placeholder = "name"; $form->add($field); // CAPTCHA - our form as argument, the function will add an InputfieldMarkup to our form $captcha->render($form); // add a submit button $submit = $this->modules->get("InputfieldSubmit"); $submit->name = "submit"; $submit->value = 'Submit'; $form->add($submit); $out .= $form->render(); // include javascript $out .= $captcha->getScript(); } echo $out; Example using plain HTML Form : $captcha = $modules->get("MarkupGoogleRecaptcha"); // if submitted check response if ($captcha->verifyResponse() === true) { $out .= "Hi " . $input->post["name"] . ", thanks for submitting the form!"; } else { $out .= "<form method='post' action='{$page->url}'>\n" . "\t<input type='text' name='name'>\n" . $captcha->render() // render reCaptcha . "\t<input type='submit'>\n" . "</form>\n"; $out .= $captcha->getScript(); } echo $out;
  19. In before better answer, there is a good tip from @horst about how to set a default language from the start. The thread is interesting too.
  20. Guys, can you edit your own post today ?
  21. Your clients can now download/view the files in the directories. ps: I can't edit my previous post ?
  22. Hello, A solution should be to bootstrap ProcessWire, coding a function which list the all the files in the current directory and subdirectories. Also, writing a custom function give you full control over the listed files, by example, filtering the files by a given allowed extension. You can test the following: In your /test directory, create a file called index.php. In the index.php write the following the code : <?php include("../index.php"); // bootstrap ProcessWire function scanDirectories($dir, $allowext, $recurse = false) { $retval = array(); // add trailing slash if missing if(substr($dir, -1) != "/") $dir .= "/"; // open pointer to directory and read list of files $d = @dir($dir) or die("Error: Failed opening directory $dir for reading."); while(false !== ($entry = $d->read())) { // skip hidden files if($entry[0] == ".") continue; if(is_dir("$dir$entry")) { if($recurse && is_readable("$dir$entry/")) { $retval = array_merge($retval, scanDirectories("$dir$entry/", $allowext, true)); } } elseif(is_readable("$dir$entry")) { $ext = substr($entry, strrpos($entry, '.') + 1); if(in_array($ext, $allowext)) { $retval[] = array( "name" => "$dir$entry", "type" => mime_content_type("$dir$entry"), "size" => filesize("$dir$entry"), "lastmod" => filemtime("$dir$entry") ); } } } $d->close(); return $retval; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Files list</title> <style type="text/css"> body { padding: 5%; max-width: 1260px; margin: 0 auto; } table { width: 100%; border-top: 1px solid #000000; padding: 0; margin: 0; vertical-align: middle; } th, td { text-align: center; border-bottom: 1px solid #000000; border-left: 1px solid #000000; padding: 0; margin: 0; } th:nth-last-child(1), td:nth-last-child(1) { border-right: 1px solid #000000; } </style> </head> <body> <h1>Files list</h1> <?php $rootdir = './'; // root directory $ext = ['jpg', 'png', 'pdf']; // allowed extensions $dirlist = scanDirectories("./", $ext, true); // output file list as HTML table echo "<table cellpadding='0' cellspacing='0'>\n" . "<thead>\n" . "<tr><th></th><th>Name</th><th>Type</th><th>Size</th><th>Last Modified</th></tr>\n" . "</thead>\n" . "<tbody>\n"; foreach($dirlist as $file) { echo "<tr>\n" . "<td><img src='{$file['name']}' width='32'></td>\n" . "<td><a href='{$file['name']}'>". basename($file['name'])."</a></td>\n" . "<td>{$file['type']}</td>\n" . "<td>{$file['size']}</td>\n" . "<td>".date('r', $file['lastmod'])."</td>\n" . "</tr>\n"; } echo "</tbody>\n"; echo "</table>\n\n"; ?> </body> </html> Copy/Upload now some images or files in /test and visit your site at http://mysite/test/ to see the result. @Karl_T code updated.
×
×
  • Create New...