Jump to content

flydev

Members
  • Posts

    1,360
  • Joined

  • Last visited

  • Days Won

    49

Everything posted by flydev

  1. As the error say, you have a write permission issue on your server. What is the server version ? It is managed by Plesk ? About the web.config file, once you get your install up and working, you will get a 404 page for the frontend and backend, so just insert this block in your web.config (tested on IIS-8) : <rewrite> <rules> <rule name="Handle request for missing favicon.ico" stopProcessing="true"> <match url="favicon\.ico"/> <action type="CustomResponse" statusCode="404" subStatusCode="1" statusReason="The requested file favicon.ico was not found" statusDescription="The requested file favicon.ico was not found"/> </rule> <rule name="Handle request for missing robots.txt" stopProcessing="true"> <match url="robots\.txt"/> <action type="CustomResponse" statusCode="404" subStatusCode="1" statusReason="The requested file robots.txt was not found" statusDescription="The requested file robots.txt was not found"/> </rule> <rule name="Access Restrictions: Keep web users out of directories"> <match url="(^|/)\." ignoreCase="false"/> <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden"/> </rule> <rule name="Access Restrictions: Protect ProcessWire system files" stopProcessing="true"> <match url="^.*$" ignoreCase="false"/> <conditions logicalGrouping="MatchAny"> <add input="{URL}" pattern="(^|/)site/assets/(cache|logs|backups|sessions|config|install)($|/.*$)" ignoreCase="false"/> <add input="{URL}" pattern="(^|/)site/install($|/.*$)" ignoreCase="false"/> <add input="{URL}" pattern="(^|/)site/config\.php$" ignoreCase="false"/> <add input="{URL}" pattern="(^|/)(wire|site)/templates-admin($|/|/.*\.(php|html?|tpl|inc))$" ignoreCase="false"/> <add input="{URL}" pattern="(^|/)site/templates($|/|/.*\.(php|html?|tpl|inc))$" ignoreCase="false"/> <add input="{URL}" pattern="(^|/)site/assets($|/|/.*\.php)$" ignoreCase="false"/> <add input="{URL}" pattern="(^|/)wire/(core|modules)/.*\.(php|inc|tpl|module)$" ignoreCase="false"/> <add input="{URL}" pattern="(^|/)site/modules/.*\.(php|inc|tpl|module)$" ignoreCase="false"/> <add input="{URL}" pattern="(^|/)(COPYRIGHT|INSTALL|README|htaccess)\.txt$" ignoreCase="false"/> <add input="{URL}" pattern="(^|/)site-default/" ignoreCase="false"/> </conditions> <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden"/> </rule> <rule name="ProcessWire Rewrite" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false"/> <conditions logicalGrouping="MatchAll"> <add input="{URL}" pattern="^/~?[-_.a-zA-Z0-9/]*$" ignoreCase="false"/> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true"/> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true"/> <add input="{REQUEST_FILENAME}" pattern="(favicon\.ico|robots\.txt)" ignoreCase="false" negate="true"/> <add input="{URL}" pattern="\.(gif|jpg|png|ico)$" negate="true"/> </conditions> <action type="Rewrite" url="index.php?it={R:1}" appendQueryString="true"/> </rule> </rules> </rewrite>
  2. Is your module autoload property set to true ? if not, then set 'autoload' => true in the module info or if you want your module to be an autoload only on the admin area, then set autoload to : 'autoload' => function () { return (wire('page')->template == 'admin'); }
  3. Welcome to the forum ? Create a file in site/template called admin.php with this code : <?php namespace ProcessWire; require($config->paths->adminTemplates . 'controller.php');
  4. Hi, check @adrian's answer there : You can also make a small autoload module which check the user's roles then redirect him accordingly.
  5. flydev

    So happy :)

    Yes I should take the time to write a showcase, I am sure that our use of ProcessWire will interest a lot of people!
  6. flydev

    So happy :)

    I'm so glad I wanted to share that with you today. Since November 2017, all of the company's infrastructure is built on ProcessWire. Whether it is the showcase website or the millions of transactions recorded in the database as pages or all the custom modules to interact with the company's data. Just to say that I feel lucky to work all the day with what I love, and when I remember that I was demoralized thinking I had to learn Wordpress or I don't know what, because before ProcessWire I never worked with a CMS and it was becoming vital. Then I stumbled on ProcessWire (hooray!). And now, a new step for me appeared yesterday. I have a trainee for a month. And my task is to teach him how to work with ProcessWire! This make me really proud ! Have a nice day everyone and again, thanks to this community and this software! ?
  7. Yeah check your PHP settings, maybe your have output_buffering = Off in place. Did you tried my second example ?
  8. Try like that : <?php sleep(3); // sleep 3 seconds echo "wake up<br>"; if (ob_get_length()) { ob_end_flush(); flush(); } sleep(3); echo "hello world<br>"; if (ob_get_length()) { ob_end_flush(); flush(); } sleep(3); or with implicit flush : $hello = ['I', 'love', 'ProcessWire', 'the end']; ob_implicit_flush(true); ob_end_flush(); for($i = 0; $i < count($hello); $i++) { echo $hello[$i].'<br>'; sleep(1); }
  9. Thanks for your time @Macrura - PR merged !
  10. Looking at the code, it seem not : public function getMatchQuery($query, $table, $subfield, $operator, $value) { // we don't allow this field to be queried throw new WireException("Field '{$query->field->name}' is runtime and not queryable"); }
  11. I just tested and it work well. And yes, look a cool module ?
  12. Although I never used this module , you can try : $page->of(false); $page->my_field = '22223333'; $page->save(); // or $page->save('my_field'); // will save only this field $page->of(true); return ""; http://cheatsheet.processwire.com/page/built-in-methods-reference/page-setoutputformatting-true-false/
  13. Nop, you have to use the name of the button. The name attribute is used to send data. Not sure I understand, but serialize in JavaScript just take the form data and put them into a string, eg: "var1=val1&var2=val2" If you pass your params from jQuery, then you can use this function to transform your string into "params" : http://www.php.net/manual/en/function.parse-str.php Otherwise In PHP you access data with $_POST, $_GET. As I said in my previous post, use the name of the field, the ProcessWire standard way.. Which one ? ?
  14. Hi marco, to populate the profile, just set and save the user information page, eg : if($input->post->checkout_submit) { // the checkout form submit action //instantiate variables taking in the form data $cart = $sanitizer->text($input->post->cart); // set other profile var... // update user details $user->of(false); $user->cart = $cart; // update the "cart" field $user->save(); $user->of(true); } As you said, you will need to add the fields to the user profile.
  15. Damn the <div class="dropdown"> is missing. echo "<div class='dropdown'> <div class'gf-flags-wpr'> ... </div> </div>"; It should work now, if not, then rename the class .dropdown to .lang-dropdown and replace each occurrence in the CSS code I give you.
  16. You could also try this before going further ( I made a small mistake on the markup) : <?php $homepage = $pages->get('/'); $langswitch = ''; foreach($languages as $language) { if(!$page->viewable($language)) continue; // is page viewable in this language? if($language->id == $user->language->id) { // current user language $langswitch .= "<li class='current'>"; } else { $langswitch .= "<li>"; } $url = $page->localUrl($language); $hreflang = $homepage->getLanguageValue($language, 'name'); $langswitch .= "<a hreflang='$hreflang' href='$url'>$language->title<b class='gf-if gspr {$language->name}'></b></a></li>"; } echo "<div class='gf-flags-wpr'> <a role='button' class='thrd' title='Language' href='#' id='gf-fbtn'> {$user->language->title} <b class='gf-if gspr {$user->language->name}'></b> <b id='gf-fbtn-arr' class='down-s-b'></b> </a> <div id='gf-f' style='display: none;'> <ul class='gf-ful' role='navigation'> {$langswitch} </ul> </div> </div>";
  17. I can see a flag on the dropdown, now if you understand how it work, you can go to https://www.flag-sprites.com/ to build your own flag sprite, its shipped with the CSS file, include it and you have to build relation between your language title (in processwire) and the CSS class. After that it will work, but you have to do some work now ? It seem that the framework Bootstrap is overriding some CSS. For more facility, follow this blog post : http://favbulous.com/post/1006/create-custom-icons-for-twitter-bootstrap-easily
  18. If you are using a variables to hold a page, then you should avoid using this same variable name in your loops. eg: foreach($footer->navigation as $subnav) instead of foreach($footer->navigation as $footer) // redefinition Now that you don't override the $footer variable in the loop, you don't even need to re-declare it, you can use it in the whole template file (not the website!). The variable $p was only available in the scope of the loop; Please have read this page: https://www.w3schools.com/php/php_variables.asp and this doc: https://processwire.com/api/variables/pages/ You are calling getLanguageValue() on a null variable ($homepage). To avoid this error, you have three way : define $homepage in the _init.php file : $homepage = $pages->get('/'); // globally available to the website define $homepage at the begining of your template file : $homepage = $pages->get('/'); call getLanguageValue() on $pages->get() : $hreflang = $pages->get('/')->getLanguageValue($language, 'name); Then the magic should happen... after you define some CSS or you will not see a dropdown and flags. There are the CSS attached to the code I give you earlier, you could try to paste it in your CSS file to see what happen and tweak it for your needs : The flags sprite is attached to this post. Some links you should read , everything is fine with basic PHP knowledge, and speaking about that, after some hours, your skills will grow ✌️ https://www.pwtuts.com/processwire-tutorials/appending-a-file-and-initialising-variables/ https://www.pwtuts.com/ https://processwire.com/docs/tutorials/ And please, install this module - https://modules.processwire.com/modules/tracy-debugger/ -so it will be a lot easier to help you, and it will help you to understand PHP and ProcessWire by debugging each vars! be curious ?
  19. Avoid using ProcessWire keywords as variable name. You are also redefining $page in your foreach loop. $page is a reserved word, instead, use : <?php $footer = $pages->get("/misc/footer/");?> then : <?php foreach($footer->navigation as $p ): ?> <?php echo $p->myfield; ?> [...] <?php endforeach; ?> then : <?=$footer->heading;?> <?=$footer->phone;?> // etc
  20. Check with the developer tools of your browser, the image should be there. @Gary Austin 's comment is right. Try with this last example, but now its more like a HTML/CSS issue : [...] // output the option tag echo "<option$selected value='$url' style='background-image:url({$language->language_icon->url});'> $language->title </option>"; [...]
  21. I didn't saw that the HTML markup is missing. You need it in order to render the image. Try again with : [...] // output the option tag echo "<option$selected value='$url'> <img src='{$language->language_icon->url}' alt='img description'> $language->title </option>"; [...]
×
×
  • Create New...