Jump to content

interrobang

Members
  • Posts

    238
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by interrobang

  1. Hi Horst, sorry, I did not mention these are new features from the dev branch. Ryan added them some months ago: http://processwire.com/talk/topic/3145-multiple-views-for-templates/?p=32876 github commit
  2. Thanks for the answer, but all my templatefiles are in "site/templates/" This way it works without having a "basic-page.php" file: include("./head.inc"); $p = $pages->get('/about'); $p->template->filename = $config->paths->templates . "basic-page-alt.php"; echo $p->render(); include("./foot.inc"); Shouldn't this be exactly the same as echo $pages->get('/about')->render("basic-page-alt.php") ?
  3. I have a setup with several templates without a templatefile. But I want to render some of the pages using these templates with $page->render($filename). I think I did not understand how the $page->render options work. A simple example: In the default profile I just delete the "basic-page.php" file and create a new file "basic-page-alt.php" with this simple code <?php // basic-page-alt.php echo "<h1>$page->template</h1>"; and I modify the home.php file to<?php // home.php include("./head.inc"); echo $pages->get('/about')->render("basic-page-alt.php"); include("./foot.inc"); When I try to view the homepage I get an errorError: Exception: Template file does not exist: '/XXX/Sites/pw_test/site/templates/basic-page.php' (in /Users/XXX/pw_test/wire/core/TemplateFile.php line 67) When I put a empty "basic-page.php" back in my templates folder I get the expected result. I am using the latest dev from github. Is this the intended behaviour?
  4. I need to output the prev/next links on all pages, even on the first/last page, but with an additional class "disabled". Whats the best way to get an output like this? Any idea how to change my output with a hook? Or should i just copy/rename the module and modify it to my needs?
  5. If you can change the document_root for each of your domains the should be no need to redirect. None of your domains should have the public_html folder as a document_root. Maybe this cpanel forum thread helps in setting up the document roots: http://forums.cpanel.net/f34/how-change-primary-domain-landing-folder-227531.html
  6. If I understand the problem correcty, the easiest solution is to organize your folder a little bit different. I would suggest that you keep each site in its own subfolder, so your public_html folder contains only some folders, but no .htaccess or similar. This way you avoid that your public_html/.htaccess rules are inherited by your other domains/sites. Use these subfolder as your document root in cPanel. public_html/example.com/ public_html/secondwebsite.com/
  7. Any news on this? I just ran into the same issue. When bootstrapped I cloud not set/save a new pagename for non-default languges. The same code in a template file works without problems. I am running the latest dev. include("./index.php"); foreach (wire('pages')->get('/projects')->children as $p) { $p->of(false); foreach (wire('languages') as $lang) { $title_translated = $p->title->getLanguageValue($lang); if ($lang->isDefault() || !$title_translated) { continue; } $pagename_field = "name$lang"; $pagename_translated = wire('sanitizer')->pageName($title_translated, Sanitizer::translate); // only set new translated pagename when empty if (strlen($p->get($pagename_field)) > 0) { continue; } $p->set("status$lang", 1); $p->set($pagename_field, $pagename_translated); $p->save(); } }
  8. I think you can enable Cross-domain AJAX requests in your .htaccess # ------------------------------------------------------------------------------ # | Cross-domain AJAX requests | # ------------------------------------------------------------------------------ # Enable cross-origin AJAX requests. # http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity # http://enable-cors.org/ <IfModule mod_headers.c> Header set Access-Control-Allow-Origin "*" </IfModule> found in html5-boilerplates .htaccess
  9. When you click on one of your languages in the site tree you don't get the usual "edit", "new", "move" menu? I am talking about moving the language pages in the site tree an the left side of the screen, not in the languages setup page you see when you go through the setup link in the top navigation. Btw, welcome to the forum!
  10. You can sort the languages in the site tree (Admin/Setup/languages)
  11. Sorry, I was only talking about Kendo UI Web, which is is dual-licensed, Commercial and Open Source (GPLv3). I think the GPLv3 version could be used on the frontend too. No?
  12. I have KendoUI in my bookmarks for some time, but never used it, so I don't want to recommend it. But it looks like it can do everything jQueryUI can do, plus some more. And at least the colors are themeable with sass. Here is a site comparing both: http://jqueryuivskendoui.com/
  13. Yes, ProCache caches the pages in a folder and adds a redirect rule to your .htaccess, but I don't think it's possible to store these files on another folder. And the cache files are only created on the first request. This mean you have to visit each page once to have a static Version of your whole site. If you just want a static version of your site I recommand using a sitegrabber or wget and upload these files to your server. I think the licence is valid forever, but you only get updates in the first year. Once installed you can keep ProCache running forever on the site. At least this is how I understood the licence, better ask Ryan if you want to know for sure.
  14. I can't say anything about HTTP Response Header tweaking, but if you don't need sessions on your pages it sounds like a perfect candidate for Ryan's excellent ProCache Module. It creates static versions of your pages und you won't have any headers set by php, as no php will be involved when delivering the pages from the cache. I use ProCache on most of my pages, and the performance is really great, especially when combined with some of the best practices from HTML5-Boilerplates .htaccess file.
  15. Either that, or I go to the settings of the PageRender module and click the "Clear the Page Render Disk Cache?" button. Most of the time I do it manually, as it clears the modules cache at once.
  16. I usually dont't exclude any folders and only clear the cache before uploading, but I think its save to exclude the contents of these folders: /site/assets/cache/ /site/assets/logs/ /site/assets/sessions/ But the folders themselves should exist and be writeable on the server too.
  17. put this into one of your templates and you can see the admin url and login: echo '<a href="'.$pages->get(2)->url.'">this way to the admin</a>'; found here: http://processwire.com/talk/topic/4491-unable-to-log-into-processwire-website/?p=44323
  18. title->getLanguageValue is the method you are looking for. Something like this should work: <?php require_once '../../index.php'; $data['markers'] = array(); $markers = array(); $affiliates = wire()->pages->find("template=affiliate"); foreach ($affiliates AS $affiliate) { $marker['latitude'] = $affiliate->mapmarker->lat; $marker['longitude'] = $affiliate->mapmarker->lng; foreach (wire('languages') as $language) { $marker['title_' . $language->name] = $affiliate->title->getLanguageValue($language);; } $data['markers'][] = $marker; } print(json_encode($data));
  19. I did a quick test and this seems to work too: $config->var = new stdClass(); $config->var->item = 'val1'; echo $config->var->item;
  20. I like the idea of this. Though my need is less the part of reusing existing fields, but creating a fieldgroup bundled with its fields. For sure it would a nice if I could even reuse existing fields like "title" and access them like somehow like this "$page->myfieldgroup->title", but I never missed this feature. I try to explain my usecase: I have some templates with a fieldgroup "metainfo" with the fields "browsertitle" and "meta_description". Currently I have to assign all these fields one by one to my templates. And if I later need some additional meta infos for facebook like "og_image" and "og_title" I have to edit all my templates to add these fields. If we would have some kind of defined fieldset, I could just assign my new fields to this fieldset and all my templates would have the new fields.
  21. Sounds strange. Maybe you have forgotten a = somewhere like this: if($page->id=1){} instead of if($page->id==1){}
  22. I never had this problem myself, but HTML5 Mobile Boilerplates .htaccess has some rules for this: # Prevent some of the mobile network providers from modifying the content of # your site: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.5. <IfModule mod_headers.c> Header set Cache-Control "no-transform" </IfModule> # Prevent mobile transcoding <FilesMatch "\.(php|cgi|pl)$"> <IfModule mod_headers.c> Header append Cache-Control "no-transform" Header append Vary "User-Agent, Accept" </IfModule> </FilesMatch>
  23. Thanks Ryan, your script works great for me. I just added some lines so my thumbnails from the ThumbnailsModule are also kept: ini_set('max_execution_time', 60 * 5); // 5 minutes, increase as needed include("./index.php"); $dir = new DirectoryIterator(wire('config')->paths->files); foreach ($dir as $file) { if ($file->isDot() || !$file->isDir()) { continue; } $id = $file->getFilename(); if (!ctype_digit("$id")) { continue; } $page = wire('pages')->get((int) $id); if (!$page->id) { echo "Orphaned directory: " . wire('config')->urls->files . "$id/" . $file->getBasename() . "\n"; continue; } // determine which files are valid for the page $valid = array(); foreach ($page->template->fieldgroup as $field) { if ($field->type instanceof FieldtypeFile) { foreach ($page->get($field->name) as $file) { $valid[] = $file->basename; if ($field->type instanceof FieldtypeImage) { foreach ($file->getVariations() as $f) { $valid[] = $f->basename; } } // keep thumbnails: if ($field->type instanceof FieldtypeCropImage) { $crops = $field->getArray(); $crops = $crops['thumbSetting']; $crops_a = explode("\n", $crops); // ie. thumbname,200,200 (name,width,height) foreach ($crops_a as $crop) { $crop = explode(",", $crop); $prefix = wire('sanitizer')->name($crop[0]); $valid[] = $prefix . "_" . $file->basename; } } } } } // now find all the files present on the page // identify those that are not part of our $valid array $d = new DirectoryIterator($page->filesManager->path); foreach ($d as $f) { if ($f->isDot() || !$f->isFile()) { continue; } if (!in_array($f->getFilename(), $valid)) { echo "Orphaned file: " . wire('config')->urls->files . "$id/" . $f->getBasename() . "\n"; // unlink($f->getPathname()); } } wire('pages')->uncache($page); // just in case we need the memory }
  24. I am not sure why, but I often have a lot of orphaned images in my page assets folder. Probably due to failed uploads? What is the best way to clean up my assets folder? No problem to loop through all my pages and find the valid files, but how do I find the orphaned ones?
  25. If your Home has the same template as your events you can use this selector: $parentmost = $page->parents("parent={$page->rootParent}")->first();
×
×
  • Create New...