Jump to content

mr-fan

Members
  • Posts

    848
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by mr-fan

  1. One question: what should i consider if i wanna two or tree pageList's in the same template? i've different "main" contentareas that would be great to show up in a dashboard like adminpage Tree 1 Images -images -cat -img -img Tree 2 News -news -post -post -post ... i did run the code above twice with different id's but it seems that the last id overwrite the first one? Could ProcessPageList only run once on a page? For that i will only create a dashboard for "fast create" the mainthings (image, newspost, special of the week and so on).
  2. Much more better - one step languagepack installation install first this one: http://modules.processwire.com/modules/language-instant-install/ LanguageInstantInstall if you are on "create new lang" page you chould choose....the 2.4 packs. for 2.4.x add this additional files from manfred62! regards mr-fan
  3. Sorry again - stupid idea! since i can't select other pages here... i use somas trick with files as pages and would have a select of files with the rootPage as the documents-page (parentpage for all docs) so this could not work as expected. i'll would have to modify the insert link modal to get whant i want - and this is far away for my skills.....so i know my borders. So i'll leave this - for the images it works great!
  4. Ok so i'm right. the code could be added to the maintain mode like this: header('HTTP/1.1 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable'); header('Retry-After: 1800');//30 min found this one is interesting, too: https://plus.google.com/+PierreFar/posts/Gas8vjZ5fmB
  5. ok you are right for this bots should not get trought but bots should get a proper HTTP 503 so this header should send to such useragents. if they get nothing at all it should be even bad as a php error or something else? But i'm not a great SEO expert - if i'm wrong here i'm willing to learn... kind regards mr-fan
  6. Next short question about changing the rootID of the ProcessPageList in a PageEditProcess: in addition to adrians gist module -> https://gist.github.com/adrianbj/437e3945e9d774f5a67e i'ld like to add a second select to the module like this: <?php class ChangeImageSelectParent extends WireData implements Module, ConfigurableModule { /** * Data as used by the get/set functions * */ protected $data = array(); /** * Default configuration for module * */ static public function getDefaultData() { return array( "rootParentImage" => "", "rootParentFile" => "" ); } public static function getModuleInfo() { return array( 'title' => 'Change Image and File Select Parent', 'version' => 1, 'singular' => true, 'autoload' => true ); } /** * Populate the default config data * */ public function __construct() { foreach(self::getDefaultData() as $key => $value) { $this->$key = $value; } } public function init() { $this->addHookAfter('ProcessPageEditImageSelect::execute', $this, 'changeParentImage'); $this->addHookAfter('ProcessPageEditLink::execute', $this, 'changeParentFile'); } public function changeParentImage(HookEvent $event) { $event->replace = true; $event->return = str_replace("rootPageID: 0", "rootPageID: ". $this->data['rootParentImage'], $event->return); } public function changeParentFile(HookEvent $event) { $event->replace = true; $event->return = str_replace("pageID: 0", "rootPageID: ". $this->data['rootParentFile'], $event->return); } /** * Return an InputfieldsWrapper of Inputfields used to configure the class * * @param array $data Array of config values indexed by field name * @return InputfieldsWrapper * */ public static function getModuleConfigInputfields(array $data) { $data = array_merge(self::getDefaultData(), $data); $wrapper = new InputFieldWrapper(); $f = wire('modules')->get('InputfieldPageListSelect'); $f->attr('name+id', 'rootParentImage'); $f->label = __('Root Parent Image', __FILE__); $f->columnWidth = 50; $f->description = __('The root page for the Image Select dialog to start from.', __FILE__); $f->attr('title', __('Root Parent Image', __FILE__)); if(isset($data['rootParentImage'])) $f->value = $data['rootParentImage']; $wrapper->add($f); $f = wire('modules')->get('InputfieldPageListSelect'); $f->attr('name+id', 'rootParentFile'); $f->label = __('Root Parent File', __FILE__); $f->columnWidth = 50; $f->description = __('The root page for the Insert File Select dialog to start from.', __FILE__); $f->attr('title', __('Root Parent File', __FILE__)); if(isset($data['rootParentFile'])) $f->value = $data['rootParentFile']; $wrapper->add($f); return $wrapper; } } The setting in the module works right - choose both rootparents. Images work - files not....i've searched in the module and js files of the ProcessPageList and the ProcessPageEditLink but still to less skill to stumble over the right piece of code.
  7. Changed.... its a fragment of the index.html from the hosting provider - that i modifed just fast without checking deeper since this pages i use only when i'm setup the website. This should be done via PW page in the backend...so i will write more about this. I found the Maintenace Mode Module too! http://modules.processwire.com/modules/maintenance-mode/ But i didn't get in the code that bots are routed properly? ...so i did it the dig in some little code way to learn more about PW! Maybe i will adapt the pregmatch for the useragent and change the Maintenace Mode Module sometimes. For now it works for me - i can build up the website if i logged in and guests will see a "wait a minute" screen. Thanks for reading my poor little snippet
  8. Hi there just a first little piece of code for a simple maintainmode. Other CMS needs a setting or something else complicated.....and with PW you've simple tools to do that easy. Using 2.4 but with template setup from the actual dev with /templates/ _func.php /functions and navigation (with MarkupsimpleNavigation.... _init.php /init _main.php /template basic-page.php home.php ... so i wanna simple build up a page or later set it in to maintainmode without loosing access for bots.... so at now i'm setting up my first pw project i've the following code running perfect for building up the page: _init.php //setting the maintainpage $maintain = <<<EOT <html><head> <title>what you wanna show</title> <meta content="text/html; charset=utf-8" http-equiv="content-type"> <style> body { some basic style } </style></head> <body> <table align="center" border="0" cellpadding="0" cellspacing="0" width="400"> <tbody><tr> <td style="padding-top: 50px;" align="center" valign="top"><img src="my-fancy-logo"></td> </tr> <tr><td style="padding-top: 50px; text-align: center"> <p>Some text on the maintain thingi</p> </td> </tr> </tbody></table> </body></html> EOT; //headline or title $headline = $page->get("headline|title"); //maincontentblock $bodycopy = $page->body; // if the current page has a populated 'sidebar' field, then print it, // otherwise print the sidebar from the homepage $homepage = $pages->get("/"); if($page->sidebar) $sidebar = $page->sidebar; else $sidebar = $homepage->sidebar; // Include shared functions include_once("./_func.php"); and in my templates that shows the different pages (aren't to much in this project) basic-page.php // default settings and fuctions include("./_init.php"); if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider/i', $_SERVER['HTTP_USER_AGENT'])) { // main template for building the page include("./_main.php"); }; if ($user->isGuest()) { echo $maintain; } else { // main template for building the page include("./_main.php"); }; This is just quik and dirty so if i've the time i would make a simple function within the _func.php and get the _main.php include a little bit smarter, especial with much more template files this shouldn't be redundant/repeated... Further improvments could be a checkbox on a backend page /settings/ maybe.....to check on/off maintain mode.....so it would be a simple switch in the Backend even a client could do.Next step could be a maintain template to get the text and content editable in the backend for everyone....should be not that hard and would made it complete!Hope this is interesting for someone... have fun mr-fan - use PW is having fun every second for me since i've not the huge times for coding stuff -
  9. I've done (with some outdated tuts on moduledev i think) something like this for input the id and it works....but your example teach me much more: public static function getModuleConfigInputfields(array $data) { /** * from a example from ryan **/ $inputfields = new InputfieldWrapper(); // ask for the id $field = wire('modules')->get('InputfieldInteger'); $field->name = 'parentid'; $field->label = "Parent ID for the ImageSelect pagetree"; if(isset($data['parentid'])) $field->value = $data['parentid']; $inputfields->add($field); } /** * Change the rootPageID to the needed parent page for the pagetree * */ public function changeParent(HookEvent $event) { $event->replace = true; $event->return = str_replace("rootPageID: 0", "rootPageID: $this->parentid", $event->return); }
  10. So solutiion comes from adrian! her the code: https://processwire.com/talk/topic/3023-module-ckeditor/page-10#entry71664 and here a small module (Parent ID could changed in the modulefile) https://processwire.com/talk/topic/3023-module-ckeditor/page-10#entry71672 next step i will try and import from other modules is to get the setting of the ID in the backend.... PW is great and the people that drives this bus are greater!
  11. ;) the same time i'll did my first module with your code and the hellowourld.module.......i like PW really!!! Did touch no line OOP Code before but in this case i've trust nothing to mess because all is logical!! Renamed my file to your suggested name and added as a zip file. other questions in the other topic now i wann learn how to add a textfield as option in the backend (now i'm hungry) i will post this on the second threat, too. Many thanks adrian for the hint and the example. ChangeImageSelectParent.zip
  12. sorry admins for the double post but i figured out that this is not really a CKE question so: https://processwire.com/talk/topic/7439-processpageeditimageselect-hook-and-change-default-page/#entry71665 i will crosslink the solution! Last but not least! Thank you very much i will try and give feedback asap....
  13. hi there i've shouted a question to setup the default path in the pagetree of the imageselect in the RTE (eqal tiny or CKE) user should only see a kinda image-root page where images and categories are pages - not the whole pagetree so i've learned it have nothing to to with CKE - so it's a Admin->Page-Insert Image with the ProcessPageEditImageSelect working here. So long ok deeper i understand that in the getImages() function the second part is build to show the pagetree for choosing a other page with images... so how can i get here only a pagetree with parent="image-root" ? is this possible without deeper OOP skills? simply hook and set the parent? hints? options? expertise? (I've a google search but didn't find any solution) regards mr-fan
  14. Is there a easy way to change the root for the pagetree of the insert images modal? i've all the images central in a pagetree with cats and images similar like the ImageManger does. I wanna only show the image-root and the subpages for the choice? regards mr-fan
  15. while reading - only one in the tuts is needed on the end of every part it would really be nice to get a little prev/next navigation? <- 1. Installing Blog 3. MarkupBlog API -> great stuff to read! Kind regards mr-fan (Maybe "kongondo" means "king of ongoing doing momentous occasions" - in a crazy non-native-speaker english )
  16. I switched CMS too......I've the comfort of a small project without a deadline. But learning PW is faster as any other cms ! As fast as this forum and the real talented users share and awnsers
  17. Hi sparrow, (RDFM) you will found this direct under the addonsdownload: Overwrite current page or root page Build a menu using a PageArray instead of a single root page so may you've got two menus one for the firstlevel and one for the second/subsites. In the basic theme that is shipped with the installation there is an example with the API and some if/foreach stuff that works without the addon. regards mr-fan more deeper in the added/updates section there is a good example to test/try added support for nav_selector property/field and selector_leveln (new in 1.2.1) You can now add a special property "nav_selector' to page(s) to define custom selector for rendering their children. This can be done on runtime or via a custom field added to pages to remotely control the selector. You can configure the name of the field by using the newly added option "selector_field". MarkupSimpleNavigation will look out for it and use it, otherwise it will use the "selector" option. You can now define selector on a per level basis. Simply use the _leveln suffix on the "selector" option, where n is the level number from the root parent. This is best illustrated by the following example: $pages->get(1001)->my_selector = "template=projects"; $options = array( "selector_level1" => "template=ressort", "selector_level2" => "start=0, limit=10", "selector_level3" => "template=news|events, sort=-created", "selector_field" => "my_selector" ); echo $nav->render($options); Note that "my_selector" has priority and will overwrite any other selctor or selector_leveln
  18. Maybe its worth to check this one....for me this is menubuilding like a boss http://modules.processwire.com/modules/markup-simple-navigation/ nearly erverthing could setup with this one sometimes with little addtions but this addon is a real timesaver.
  19. mr-fan

    Hanna Code

    I've double ask would it be nice to have a little hanna gallery with structured and sorted hanncode?? Could be a nic addition to the addons page? with some given parameters like name, desc, importcode, vars
  20. mr-fan

    Hanna Code

    Some little new hannas from my playground with a question: //BDay //Use this with [[bday?d=1950-12-31]] //You can add this to any place, even in the title of a link or alt text of an image. Also future day possible. !HannaCode:BDay:eyJuYW1lIjoiQkRheSIsInR5cGUiOiIyIiwiY29kZSI6IlwvKmhjX2F0dHJcbmQ9XCIyMDAwLTEtMVwiXG5oY19hdHRyKlwvXG48P3BocFxyXG5cclxuXC9cL1VzZSB0aGlzIHdpdGggW1tiZGF5P2Q9MTk1MC0xMi0zMV1dXHJcblwvXC9Zb3UgY2FuIGFkZCB0aGlzIHRvIGFueSBwbGFjZSwgZXZlbiBpbiB0aGUgdGl0bGUgb2YgYSBsaW5rIG9yIGFsdCB0ZXh0IG9mIGFuIGltYWdlLiBBbHNvIGZ1dHVyZSBkYXkgcG9zc2libGUuXHJcblxyXG4kb3V0cHV0X3ZhbHVlID1cIlwiO1xyXG4kZD10cmltKCRkKTtcclxuJGRhdGVub3c9ZGF0ZShcIlktbS1kXCIpO1xyXG4kZGlmZj1zdHJ0b3RpbWUoJGRhdGVub3cpLXN0cnRvdGltZSgkZCk7XHJcbmlmKCRkaWZmIDwwKSRkaWZmPSRkaWZmICogLTE7IFwvXC9ubyBuZWdhdGl2ZSB2YWx1ZXNcclxuJGRheXM9Zmxvb3IoKCRkaWZmKVwvODY0MDApO1xyXG4keWVhcnM9cm91bmQoKCRkaWZmIFwvMzE1MzYwMDApLCAyKTtcclxuXHJcblwvXC9ERUJVR1xyXG5cL1wvJG91dHB1dF92YWx1ZT1cIiRkYXRlbm93ICRkIEFnZSBpcyAkeWVhcnMgeWVhcnMuIFRoYXQncyAkZGF5cyBkYXlzXCI7XHJcbiRvdXRwdXRfdmFsdWU9XCJBZ2UgaXMgJHllYXJzIHllYXJzLiBUaGF0J3MgJGRheXMgZGF5c1wiO1xyXG5cclxuZWNobyAkb3V0cHV0X3ZhbHVlOyJ9/!HannaCode and //countdown //d_day=(day) d_month=(mont) d_year=(year) txt1=(text_before) txt2=(text_after) //Use [[countdown?d_day=25&d_month=12&d_year=2009&txt1=Only&txt2=days until it is Christmas]] !HannaCode:Countdown:eyJuYW1lIjoiQ291bnRkb3duIiwidHlwZSI6IjIiLCJjb2RlIjoiXC8qaGNfYXR0clxuZF9kYXk9XCIyNVwiXG5kX21vbnRoPVwiMTJcIlxuZF95ZWFyPVwiMjAxNFwiXG50eHQxPVwiT25seVwiXG50eHQyPVwiZGF5cyB1bnRpbCBpdCBpcyBDaHJpc3RtYXNcIlxuaGNfYXR0cipcL1xuPD9waHBcclxuXHJcblwvXC9kX2RheT0oZGF5KSBkX21vbnRoPShtb250KSBkX3llYXI9KHllYXIpIHR4dDE9KHRleHRfYmVmb3JlKSB0eHQyPSh0ZXh0X2FmdGVyKVxyXG5cL1wvVXNlIFtbY291bnRkb3duP2RfZGF5PTI1JmRfbW9udGg9MTImZF95ZWFyPTIwMDkmdHh0MT1Pbmx5JnR4dDI9ZGF5cyB1bnRpbCBpdCBpcyBDaHJpc3RtYXNdXVxyXG5cclxuJHRvZGF5ID0gdGltZSgpO1xyXG4kZGF5WCA9IG1rdGltZShkYXRlKCdHJyksIGRhdGUoJ2knKSwgMCwgJGRfbW9udGgsJGRfZGF5LCAkZF95ZWFyKTtcclxuZWNobyAkdHh0MS4nICcgLnJvdW5kKCgkZGF5WC0kdG9kYXkpXC8oMzYwMCoyNCksMCkuJyAnLiAkdHh0MjsifQ==/!HannaCode so in my former cms (there was a similar addon called droplets) i could get the whole rendered page as a $var or the contentpart of it and could make a nice CreateToc droplet that search for Headingtags and build up the TOC: preg_match_all( '#<h([1-6]).*>([^<].+)</h[1-6]>#i', $wb_page_data, $matches, PREG_PATTERN_ORDER ); the var $wb_page_data gets the actual pagecontent to analyse by the droplet (=HannaCode). Is there a similar option or could i simply use the render() function on the parts of the page that i wanna get into the TOC? Kind regards mr-fan
  21. thanks in advice! my first pw project is comming along - there is a not fancy newspage to setup so i'll give the /archiv/ solution a try and report. i think for the beginning i wonna accomplish the most stuff with "onboard" technics and later go deeper with modules.....to learn first properly the system* then the scope of the hooks and modules. *since i've done webdesign/dev as a second-job (working for a social NGO the maintime - and have a little farm at home) i'm always in lack of time especially in the summer (harvest)
  22. Easy as expected... Date archiver sounds very interesting, too for good/speaking newspostsurls. One simple question stands - both solutions - change parent and setup pages with date archiver: With enabled path history module (core) are the urls/paths keep working for this pages? Important for seo with news posts I think... In my former cms articleaddon you could set the URL different from the logical place in backend.
  23. Is it possible to change simple the parent page? For eg from /posts/ to /archive/ ?
  24. since this is working great in 2.4.11 too it should be a pullrequest on github? Great module - really easy to work and get the idea for forms with PW. Is there a threat/topic (i'd searched) for multistep forms? Or a hint to get on the right path? kind regards mr-fan
  25. Or simple one parent "plates" with all available pages (could be created ready to use) and just with a field to check "in use" ? So no page generation needed just a update on one field? And sorting/displaying would be easy... Just some mindgames - didn't setup something yet.
×
×
  • Create New...