Jump to content

Soma

Moderators
  • Posts

    6,803
  • Joined

  • Last visited

  • Days Won

    159

Everything posted by Soma

  1. XML feeds would be a valid solution, without knowing the details of what the content is. But Ryan is doing it aswell in some of his sites to share content between installations. Other solutions would be to import them from text or html files. I'm doing a reports website of a company where we get static html files and I have a script to import them in 1 click. It's a matter of reading and parsing the files, create a new page, put them in the textfield and save. $content = file_get_contents($url_to_file); $content = str_get_html($content); // using http://simplehtmldom.sourceforge.net/manual.htm $p = new Page("basic-page"); $p->parent = "/news/"; $p->title = $content->find("h1",0)->plaintext; $p->body = $content->find("#main",0)->innertext; $p->save();
  2. Everybody knows or seen it I thought, if you're into data viz. I think you know it already but there's also some others http://raphaeljs.com/ http://g.raphaeljs.com/ http://www.highcharts.com/ http://www.kendoui.com/dataviz.aspx
  3. I saw that too. ROFL no way
  4. public function init() { $this->addHookAfter("ProcessPageList::execute",$this, "addScripts"); } 1 2 3 test
  5. Hmm, ok after another cache clearing, the editor is back again.
  6. Uncaught ReferenceError: IPS_extra_plugins is not defined /talk/public/js/3rd_party/ckeditor/ips_config.js?t=C6HH5UF:71 There's only a white area where the editor should be. Chrome OSX.
  7. I can't see the editor anymore after deleting cache and also there's an error in the console with processwire theme 2. I had to switch to mobile to post this. Otherwise great update!
  8. Sorry I was on mobile and didn't read carefully... I think Nik is right. And I think you have "advanced" diabled on cheatsheet, that's why you don't see it
  9. Next is shown on cheatsheet aswell. So next gives you the next page in the tree or array and if you echo it it gives you the id only, so you have to add the field you need , in your case ->name.
  10. $page->next->url is what you are looking for.
  11. @Nicole. The code Ryan provided are examples that archive what my code does, but using direct SQL queries with $db var. $result = $db->query("SELECT COUNT(*) FROM field_comments WHERE status=0"); list($numPending) = $result->fetch_row(); echo "<p>There are $numPending comments waiting approval</p>"; This does the same as my code example. It's just much more efficient to do it this way with direct SQL query. "field_comments" would be the "comments" field. Each field you create has a table with it's name in the database. Ryan just gave those examples because there's no implementation in the API that would do this ATM, so my code is kinda an not so effective version of it as it has to loop through all pages that have comments. This is no problem with smaller sites, but the more pages with comments there are the slower it would get. While it should work well up to couple hundreds of pages, Ryan's method would scale up to hundred thousands pages easily before getting any noticeable impact.
  12. Soma

    Before PW & After PW

    Before After
  13. I use this excellent golden module by apeisa master: http://modules.processwire.com/modules/process-redirects/
  14. To get all pending comments you'd have to loop through all pages that can have comments and have more than 0 comments. Then find the pending comments (status=0) and count them. $total = 0; foreach($pages->find("comments.count>0") as $p){ $total += $p->comments->find("status=0")->count(); } echo "$total comments pending";
  15. Soma

    Before PW & After PW

  16. Have you named the template "language_gateway" or changed the new configuration to match your gateway template name?
  17. It's working fine here. Have you removed any code from gateway template?
  18. Update to 0.1.1 information - Changed the method to parseUrl and page rendering into the module. This is to prevent the infamous "double render" issue and also make it work with prependTemplateFile, appendTemplateFile config introduced in latest PW 2.3. (Skyscraper profile anyone). - Added gatewayTemplate option in the module confiuration. For this to work, the gateway template used to create the gateway pages /en/, /de/ etc, must be named to "language_gateway" (default) to make it work, or change the name in the module configuration to fit your template's name. The template file is now just a empty file and you can remove the code. Thanks
  19. Yeah, I noticed while trying the prependTemplateFile with LanguageLocalizedURL module. I found a solution to avoid the issue and also the double render issue it had before with render method. I commited an update to 0.1.1 and will update the module thread later.
  20. Just looked like it's in a subfolder, in your error "/path/site/templates/language-gateway.php" /path/site/... So the first example doesn't work with urls which was wrong. It should be $config->paths->templates instead. <?php $page = $modules->get('LanguageLocalizedURL')->parseUrl(); include($config->paths->templates . $page->template . ".php"); Ah yes I see, this was added recently, somehow missed it or couldn't remember.
  21. BTW what is prependTemplateFile appendTemplateFile? There's no such API method in PW.
  22. Maybe because you got PW in a subfolder of webroot? It could also be written like this <?php $localizedpage = $modules->get('LanguageLocalizedURL')->parseUrl(); include("./{$localizedpage->template}.php");
  23. Nicole, that's what my first solution is like, and this is how it's meant to work. You add the two fields to the page you want them and in the template file you output markup that will take those two values as to construct the selector needed. If you set that up, nobody has to change code, but you can edit it via those 2 fields. In PW you don't get fields that output markup by itself, you need at least some echo $page->field. Of course it would be possible to make the field output a markup string and not the plain or formated value. But it goes beyond what you really need and it would take a long post to explain everything. Doing a fieldtype which has two inputfields is even more complicated and in the end it is what the template/field setup in PW is made for, so you'd only mimic what is already there. My solutions show already what you could do otherwise, you have some alternatives.
  24. Look at my corrected code, you was too fast. $page->template only returns name without ".php".
×
×
  • Create New...