Jump to content

abdus

Members
  • Posts

    743
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by abdus

  1. Delete past browsing and site data. The browser might have been caching redirects and you are being redirected to the same (incorrect) url even after the problem was fixed somewhere along the line. for Firefox: https://superuser.com/questions/467999/clear-301-redirect-cache-in-firefox for Chrome: https://superuser.com/questions/1166181/how-to-clear-cached-redirects-in-chrome
  2. You should also note that the images inside the html CKE fields will still point to the source page. So copying images alone may not be sufficient.
  3. You might be able to get them working by copying from /site/assets/files/<sourcepageid> to files/1
  4. They're quite useful for handling dynamic urls, I'd really suggest practice using them in a project. You're missing out.
  5. That would score worse in terms of SEO, though. Having a homepage that immediately redirects is frowned upon. You cannot supress with urlSegments if the page already exists. From @ryan: https://processwire.com/docs/tutorials/how-to-use-url-segments/page2
  6. That looks great. Somewhere between Reno, Default and UIKit, I like it. Well, that sucks. But it looks like a simple mod, so it wouldn't take much time to rewrite.
  7. Also, find your apache access logs, check whether rewritten urls has ?it=/admin/ in it
  8. Well, then then I'm back to suggest checking .htaccess rule 19. This has to work for PW to handle requests to pages other than homepage. # ----------------------------------------------------------------------------------------------- # 19. Pass control to ProcessWire if all the above directives allow us to this point. # For regular VirtualHosts (most installs) # ----------------------------------------------------------------------------------------------- RewriteRule ^(.*)$ index.php?it=$1 [L,QSA] # ----------------------------------------------------------------------------------------------- # 20. If using VirtualDocumentRoot (500 NOTE): comment out the one above and use this one instead # ----------------------------------------------------------------------------------------------- # RewriteRule ^(.*)$ /index.php?it=$1 [L,QSA] </IfModule> ################################################################################################# # END PROCESSWIRE HTACCESS DIRECTIVES #################################################################################################
  9. Open .htaccess file and smash your keyboard, save the file, refresh your browser, if you get an error, then .htaccess is working too. https://stackoverflow.com/a/17250196
  10. Then .htaccess isn't read at all by apache. You may need to allow overrides. https://askubuntu.com/a/465589
  11. https://stackoverflow.com/a/14294970
  12. That should be enough to get rewrite working, but as it's not working then most likely rewrite isn't enabled/.htaccess isn't parsed by apache.
  13. If the rewrite isn't working you wont even get to the login form, it just redirects back to homepage like you've been experiencing
  14. I'm not experinced in Apache, but it looks like apache rewrites url incorrectly. There should be a .htaccess file on the root directory of PW and inside it you should see # ----------------------------------------------------------------------------------------------- # 19. Pass control to ProcessWire if all the above directives allow us to this point. # For regular VirtualHosts (most installs) # ----------------------------------------------------------------------------------------------- RewriteRule ^(.*)$ index.php?it=$1 [L,QSA] # ----------------------------------------------------------------------------------------------- # 20. If using VirtualDocumentRoot (500 NOTE): comment out the one above and use this one instead # ----------------------------------------------------------------------------------------------- # RewriteRule ^(.*)$ /index.php?it=$1 [L,QSA] If it's still not working rewrite module may not be activated https://stackoverflow.com/a/5758551
  15. Put/replace <?php namespace ProcessWire; at the first line of the template.
  16. I was expecting to find a method to hook before admin theme in the hopes that I could modify $config->styles, but unfortunately there's none. Here's how AdminThemeDefault uses it: // /wire/core/modules/AdminTheme/AdminThemeDefault/default.php $config->styles->prepend($config->urls->root . "wire/templates-admin/styles/AdminTheme.css?v=$version"); $config->styles->prepend($config->urls->adminTemplates . "styles/" . ($adminTheme->colors ? "main-$adminTheme->colors" : "main-classic") . ".css?v=$version"); $config->styles->append($config->urls->root . "wire/templates-admin/styles/font-awesome/css/font-awesome.min.css?v=$version"); $ext = $config->debug ? "js" : "min.js"; $config->scripts->append($config->urls->root . "wire/templates-admin/scripts/inputfields.$ext?v=$version"); $config->scripts->append($config->urls->root . "wire/templates-admin/scripts/main.$ext?v=$version"); $config->scripts->append($config->urls->adminTemplates . "scripts/main.$ext?v=$version"); ... <head> ... <script type="text/javascript"><?php echo $helpers->renderJSConfig(); ?></script> <?php foreach($config->styles as $file) echo "\n\t<link type='text/css' href='$file' rel='stylesheet' />"; ?> <?php foreach($config->scripts as $file) echo "\n\t<script type='text/javascript' src='$file'></script>"; ?> <?php echo $extras['head']; ?> </head> Here's how AdminThemeReno uses it: // /wire/core/modules/AdminTheme/AdminThemeReno/default.php // Styles $config->styles->prepend($colorFile . "?v=" . $version); $config->styles->prepend($config->urls->root . "wire/templates-admin/styles/AdminTheme.css?v=$version"); $config->styles->append($config->urls->root . "wire/templates-admin/styles/font-awesome/css/font-awesome.min.css?v=$version"); // Scripts $config->scripts->append($config->urls->root . "wire/templates-admin/scripts/inputfields.$ext?v=$version"); $config->scripts->append($config->urls->root . "wire/templates-admin/scripts/main.$ext?v=$version"); $config->scripts->append($config->urls->adminTemplates . "scripts/main.$ext?v=$version"); ... <head> ... <script type="text/javascript"><?php echo $helpers->renderJSConfig(); ?></script> <?php foreach($config->styles as $file) echo "\n\t<link type='text/css' href='$file' rel='stylesheet' />"; ?> <?php foreach($config->scripts as $file) echo "\n\t<script type='text/javascript' src='$file'></script>"; ?> <?php echo $extras['head']; ?> </head> There arent any method calls anywhere. BUT, with my SUPER hacky way, you can intercept the styles as they're added to $config->styles. <?php namespace ProcessWire; // /site/templates/admin.php class MyFileArray extends FilenameArray { private function intercept($filename) { if (strpos($filename, '/templates-admin')) return true; elseif (strpos($filename, '/AdminTheme')) return true; } public function append($filename) { if (!$this->intercept($filename)) { parent::append($filename); } } public function prepend($filename) { if (!$this->intercept($filename)) { parent::append($filename); } } } /** @var Config $config */ $config->styles = new MyFileArray(); require($config->paths->adminTemplates . 'controller.php');
  17. You can kinda "clone" a page into home page like this, but it can't copy image/file fields (as far as I tested). $source = $pages(1015); $home = $pages(1); $source->of(false); $home->of(false); // change template (remember to create new template file and allow access to guest users in Template > Access) // $home->template = $source->template; foreach($source->template->fieldgroup as $f) { if ($home->hasField($f)) $home->$f = $source->$f; } $home->save();
  18. Probably because the module is outdated by 2 years. Last commit was at Sep 7, 2015
  19. Log something in your class constructor and check /site/assets/logs/<class>.txt, if you're seeing multiple entries, then the class is being instantiated more than once. Otherwise something else is calling init() method public function __construct() { $this->log('test'); }
  20. Having 'singular' => false (default) in your getModuleInfo() method allows multiple instances of the module. If you're instantiating the module in one of your template files and it gets executed more than once, init() method will be called for each instance. You can set singular to false to limit the module to single instance, but the issue might be caused by something else.
  21. That was really helpful, thanks a lot. As the field (a simple comment system, basically) will be containing a lot of text, returning null looks like a better choice.
  22. I'm developing a multi value fieldtype and there's this method called getLoadQueryAutojoin(). // FieldtypeMulti.php /** * Return the query used for Autojoining this field (if different from getLoadQuery) or NULL if autojoin not allowed. * * @param Field $field * @param DatabaseQuerySelect $query * @return DatabaseQuerySelect|NULL * */ public function getLoadQueryAutojoin(Field $field, DatabaseQuerySelect $query) { if($this->get('useOrderByCols')) { // autojoin is not used if sorting or pagination is active $orderByCols = $field->get('orderByCols'); if(count($orderByCols) > 0) return null; } $table = $this->database->escapeTable($field->table); $schema = $this->trimDatabaseSchema($this->getDatabaseSchema($field)); $fieldName = $this->database->escapeCol($field->name); $separator = self::multiValueSeparator; foreach($schema as $key => $unused) { $query->select("GROUP_CONCAT($table.$key SEPARATOR '$separator') AS `{$fieldName}__$key`"); // QA } return $query; } Why would someone need to autojoin a field, or not need a autojoin? Any benefits/drawbacks? I havent used the feature it at all in my 3+ years PW experience. I'm not sure whether I need to implement it but I am leaning towards returning null and disable it altogether.
  23. SASS source files for the admin template is available in the core, you can modify and compile them to suit your setup.
  24. SVG icons for the anchor links seems to be the issue
×
×
  • Create New...