Jump to content

abdus

Members
  • Posts

    743
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by abdus

  1. This error occurs if you dont have namespace declared inside the file. Try putting <?php namespace ProcessWire; to the first line. Edit: You should add namespace to all template files to prevent the errors when compilation is disabled. This is actually FileCompiler's purpose, refreshing the page once is often enough to recompile files, but I am not sure why it's not working for you.
  2. @Xonox You can disable compilation for template files while developing using // /site/config.php // disable template compilation when debug mode is active // or set false to disable compilation completely $config->templateCompile = !$config->debug;
  3. Make sure that php files start with <?php namespace ProcessWire; to prevent them from getting compiled. https://processwire.com/blog/posts/processwire-3.0.14-updates-file-compiler-fields-and-more/#how-to-bypass-the-file-compiler https://processwire.com/blog/posts/processwire-3.0.14-updates-file-compiler-fields-and-more/#file-compiler-updates https://processwire.com/blog/posts/processwire-3.0.43-core-updates/#new-filecompiler-options
  4. Use exec() to run a background task that curls your page maybe? http://stackoverflow.com/a/4628279
  5. https://processwire.com/talk/forum/12-themes-and-profiles/ http://modules.processwire.com/categories/site-profile/
  6. You can, (just tried it myself), but make sure to make a backup first. (http://modules.processwire.com/modules/process-database-backups/) caches table holds information about FileCompiler (which files it compiled and when), module infos, caches saved using $cache variable etc. When you refresh, you may experience a bit of delay before all caches (accessed during current request) are generated again.
  7. You may not have PHP-GD installed on the new server. Check out these topics for pointers on similar image upload issues. https://processwire.com/talk/topic/16144-cant-upload-images/ https://processwire.com/talk/topic/1907-cant-upload-images-to-a-page/
  8. abdus

    The Crafters

    How did you get progressive JPEGs with several layers of scans? Photos on the site are loaded layer by layer, first pixelated B&W, then B&W, then color layer and so on? Did you use any specific tools? Are there any filesize disadvantages with using so many layers?
  9. Can you share the exact line of the error? Is it around here? https://github.com/ryancramerdesign/skyscrapers2/blob/master/_func.php#L246 It's probably because you dont have FieldtypeMapMarker module installed, which brings us to: You need to install the module from Modules > Install > Add New > (scroll down to Module Class Name) type in FieldtypeMapMarker > Download and Install > (Confirm again)
  10. You shouldn't use the actual token value you get from the session, you must use the value from the guest. The whole premise of CSRF (cross site request forgery) protection is to detect requests with invalid/missing tokens, so you know they're originated from a form on your site. If you don't use the posted value (a field starting with TOKEN in $input->post and its value that is sent with the request) you're practically removing CSRF protection altogether.
  11. Do you have redirects? Check the developer console on your browser for double requests and 301 responses. If you have redirects, make sure you're specifying exact URL of the endpoint (with or without trailing slash)
  12. You can hook into ProcessPageEdit::buildForm and modify its arguments. You can add readonly attribute to all text fields (disabled works too), remove submit buttons and disable uploads. wire()->addHook('ProcessPageEdit::buildForm', function (HookEvent $e) { $editorRoles = ['senior', 'marketing', 'office-management']; foreach ($editorRoles as $role) { if (wire()->user->hasRole($role)) return; } // set all text fields readonly $form = $e->arguments(0); foreach ($form->find("type%=text") as $ta) { $ta->attr('readonly', true); } // remove submit buttons foreach ($form->find("type%=submit") as $button) { $form->remove($button); } // disable uploads foreach ($form->find("name%=image|file") as $uploadable) { $uploadable->noUpload = true; } }); But removing submit buttons leaves dropdown items behind which I think is added with JS, so you may need use JS to remove it. (I'm using AdminThemeUIKit, other themes might be different) [].forEach.call(document.querySelectorAll('.pw-button-dropdown'), dd => dd.parentNode.removeChild(dd)); I'm not sure about other fields, though.
  13. Shouldn't files be owned by www-data user & group? In most setups (unless overriden) web service and php run as www-data (and user and files should be owned by www-data group). What does php run as in your case? https://unix.stackexchange.com/a/30191 Also what does date return in bash? and date() in PHP?
  14. (Did you restart PHP service?) Any other pages or templates have working image uploads? When you delete the pagefiles directory (/site/assets/files/213 etc), can PW create and upload the file inside?
  15. @Lewis, php configuration is handled by /home/dim1055/etc/php5/php.ini file, add that directive to end of the file. In case it doesnt work, (probably wont as you're on PHP v5.6.30) this STO answer seems to answer why it didnt work/how to get it working. https://magento.stackexchange.com/a/93490 FYI, you shouldn't expose phpinfo() to public, it reveals sensitive/potentially dangerous info about your system.
  16. First check your php version with php --version, because this directive was removed in PHP 7.0 If you're on PHP 5.x, you must have root access to php.ini to change this setting. On debian based systems (tried on Ubuntu) you can find the location of php.ini using locate php.ini and edit fpm/php.ini (if you're using nginx or some other http server/proxy) or cli/php.ini if you're using cli version (apache)
  17. I use a partial template for those. I have a meta-social.php where I keep FB, Twitter specific meta tags, and call it (and optionally pass specific variables) with wireRenderFile('partial/meta-social', ['a' => 1, 'b' => 2]); inside template files. Same for JSON+LD data for microdata. region('foot+', partial('meta-breadcrumbs')); region('foot+', partial('meta-site')); region('foot+', partial('meta-analytics')); region('+head', '<link rel="dns-prefetch" href="//www.google-analytics.com">'); For prefetch tags, like CSS, and JS that needs to be in every page, I use _init.php that is prepended to every template (using $config->prependTemplateFile), but template specific assets goes to individual template files. If you're using delayed output strategy, I recomment region() function that comes with Functions API (enable $config->useFunctionsAPI = true) where you can define regions and append prepend any string. https://processwire.com/blog/posts/processwire-3.0.39-core-updates/#new-functions-api
  18. Okay, after some remote debugging collaboration with @Timea over Teamviewer, it turns out there was a typo where he/she created/renamed the comments field to Comments and tried to render it using $page->comments where he/she should've used $page->Comments instead. After renaming the field back to lowercase comments, error was fixed
  19. You should place <?php namespace ProcessWire to very first line of the script (to the opening <?php tag), it should look like this
  20. Can you post the output of var_dump($page->comments); Also, try adding namespace <?php namespace ProcessWire; on the first line of basic-page.php
  21. Does basic-page template have comments field?
  22. You can do this with a few lines of JS (function(){ let inputs = document.querySelectorAll('.InputfieldWrapper .Inputfield'); [].forEach.call(inputs, item => { let input = item.querySelector('[name]'); if(!input) return; let label = item.querySelector('label'); if(!label) return; let inputName = label.htmlFor.replace(/(\w+)_(\w+)/, '$2'); let span = document.createElement('span'); span.style.display = 'inline-block'; span.style.color = 'tomato'; span.style.border = '2px solid'; span.padding = '0.25em 0.25em'; span.margin = '0 0 0 0.25em' span.innerHTML = inputName; label.appendChild(span); }); })(); Run this in Developer Console on your browser and you'll get this To automate this, you can put this script in a JS file in /site/templates/admin/labels.js, and enqueue it inside your /site/ready.php // /site/ready.php if ($page->template->name === 'admin') { $config->scripts->add($config->urls->templates . 'admin/label.js'); }
  23. I dont know how they work internally, whether they depend on each other, but I'd love to be able to test and buy RepeaterMatrix or Multiplier or Table (or any other) module individually. Whole pack of ProFields modules seems awesome to have, however, being able to buy one for ~$30 --instead of all for $130-- sounds much more affordable and this way I could buy the whole pack part by part in several months and wouldn't think twice. But $130 at once, I can't really justify it (and still havent been able to) just as easily with low (to none) disposable student income. Or instead, having sales one - twice a year would be great as well. One advantage of this change would be allowing more people to buy -> support the development & community -> give feedback -> improve these products. This could also potentially pose a disadvantage where requests from people would increase the headache and time required to respond to all these requests, but this community is more than able to handle that. I'm sure there's a reason to why these modules are sold together, and I'd love to hear your side as well, @ryan, (and all other maintainers). Regards, Abdus.
  24. You should see the details of the error when you're logged in. For instance when I <?php var_dump(wire()->users->find('id>0')); // lists all users I get an output like this object(ProcessWire\PageArray)#330 (7) { ["hooks"]=> array(2) { ["PageArray::render"]=> string(60) "MarkupPageArray->renderPageArray() in MarkupPageArray.module" ["PageArray::renderPager"]=> string(56) "MarkupPageArray->renderPager() in MarkupPageArray.module" } ["count"]=> int(2) ["items"]=> array(2) { [0]=> string(23) "/pw/access/users/admin/" [1]=> string(23) "/pw/access/users/guest/" } ["total"]=> int(2) ["start"]=> int(0) ["limit"]=> int(0) ["selectors"]=> string(45) "id>0, sort=sort, parent_id=29, templates_id=3" }
  25. Do you have namespace <?php namespace ProcessWire; declared on top of your files? What shows up when you var_dump($userlist) inside the function?
×
×
  • Create New...