-
Posts
2,769 -
Joined
-
Last visited
-
Days Won
31
Everything posted by Martijn Geerts
-
I'm not sure, but here's a try: On line 40: is getting $page, from there you could handle your logic. And if you decide to output nothing you could do a: $event->return = false; Please correct me when I'm wrong.
-
@arjen I'm using php from liip, formally from entropy.ch. I use it since MacOS 10.2 or so. Never had any problems with it. It's easy to install, and runs on the native Apple shipped Apache. And works out of the box with the default MySQL Server If you're want to shift or interested leave me a message.
-
Have a look at /api/fieldtypes/images/
-
@kongondo, you sneeked up in the list And Pete is NR1
-
upload file to page with friendly name as well as description?
Martijn Geerts replied to wilsea's topic in Getting Started
<qoute rel='soma'>so that later I can then display links to the file using the meaningful name.</qoute> -
You have, al other stuff is listed there. But not the "Access Secret". Thanks. ( reading is difficult sorry )
-
Just installed this module. But I can't figure out what the "Access Secret" is in the modules configuration settings. Where can I find it ? I can't find it at dev.twitter.com Thanks.
-
I'm not using WYSIWYG long enough I think. Only the 2,5 year i'm working as web developer. When I first started with a CMS and WYSIWYG, MODX Revolution was already released. So only used the one in MODX Revo, and those in ProcessWire. Thank you to bring "install with profile" back to life.
-
Sorry to go offtopic but, I'm thinking loudly here. Should there be a way for $modules to set a minimum browser requirement , that can be picked up bij ProcessWire ? public static function getModuleInfo() { return array( 'title' => 'Module Title', 'summary' => 'Great Module', 'version' => 100, 'compatibility' => 'IE8' // minimum IE8 ); } ( I think compatibility problems has almost al the time to do with the browsers from our friends in Redmond, so this could be tight to IE). Especially for wysiwyg editors, the weight of the source code can drop dramatically when they can use native browser features not available in versions of Explorer.
-
Oops, didn't read your post well enough. (to sleepy for that tiny MS laptop). <script> $(function() { // add Classname $('a[href*="/assets/files/"]:has(img)').addClass('sj_image_popup'); // initialize magnific popup $('.sj_image_popup').magnificPopup({ type: 'image', closeOnContentClick: true, image: { verticalFit: true, titleSrc: function(item) { return item.el.find("img").attr("alt"); } } }); }); </script>
-
I think it's bad practice to depend on $modules->get('JqueryFancybox'). Now you're depending on ryan's updates. ( new versions will use MagnificPopup, so probably this stops working after a while ) Next, jQuery is now loaded twice. First is the old one 1.4.2 that came with the default install. ( I think ) Better to not use Fancybox anymore. It's old and depending on old jQuery versions, relying on $.browser which is deprecated for a long time. Oké, to work: 01. Remove your $modules->get('JqueryFancybox') call. 02. revove the old jQuery 1.4.2. link. 03. Grab a new version jQuery and make sure that it is loaded first before all other scripts. 04. Take a look at other lightbox scripts. I do like magnific popup (instructions) if all scripts are loaded: $(function() { // Teppo's add class trick $('a[href*="/assets/files/"]:has(img)').addClass('InputfieldFileLink') $('.InputfieldFileLink').magnificPopup({type:'image'}); });
-
Think you have to set: $t->useRoles = 1; $t->set("roles", array('1234')); // where 1234 is the ID of the role you want to add.
-
// never done this, but I think this may work $member_role = $roles->get('member'); $member_role->addPermission('page-edit'); $member_role->save();
-
Assumed that the role is called 'member': click: Admin » Access » Roles » member, There you could set permissions then at template level, you can specify select them
-
I'm not sure about this, but could you try: $u->language = $languages->get("english"); ps, I think $user is a bad variable name, because $user is the current user. Also note that the guest role is added automagically.
-
Use cases for Page FieldType returning NullPage vs. null?
Martijn Geerts replied to bracketfire's topic in Getting Started
Simple explanation: // Type Null (variable with no value) echo $p->id // throws error. // Type NullPage (object type of NullPage) echo $p->id // outputs 0, evaluate to false if(!$p->id) { echo "We have a NullPage"; } else { // we have a valid Page echo $p->title; } Not relevant to your question: /** * Here $page is always that selector, so always true. * You need atleast a double == * I prefer the tripple version === , then type also matters */ if ($page->id !== 0) { $page->stuff... } else { // not found stuff } // little bit changed, to clarify take a look: comparison operators -
You could solve this with javascript/jQuery. <script> // document ready $(function(){ // add class InputfieldFileLink, to every href that links to an image. $("a[href$='.jpg'], a[href$='.gif'], a[href$='.png']").addClass('InputfieldFileLink'); $(".InputfieldFileLink").whatEverLightBoxYouLike(); }); </script> (extended the post)
-
Actually I think it's better to disallow those features for a certain role. Then those buttons will also be gone. Here I assume that the role is named member. public function init() { // only for member if(!$this->user->hasRole('member')) return; // several hooks $this->addHookAfter('Page::sortable', $this, 'hookPageSortable'); $this->addHookAfter('Page::deleteable', $this, 'hookPageDeleteable'); $this->addHookAfter('Page::moveable', $this, 'hookPageMoveable'); $this->addHookAfter('Page::editable', $this, 'hookPageEditable'); $this->addHookAfter('Page::addable', $this, 'hookPageAddable'); } Here a methode, to give you some start: public function hookPageSortable( HookEvent $event) { $event->return = false; return; }
-
setlocale(LC_ALL, 'nl_NL'); $time = time() . "<br>"; echo strftime('%Y-%m-%d', $time); // this took a whole lotta time ! (to function )
-
How to handle large amounts of data?
Martijn Geerts replied to Chris Rosenau's topic in General Support
I would go the pages & API route, it's very quick! You could make a big array & loop it: $cities = array( 'Albany, NY', 'Albuquerque, NM', 'Anchorage, AK', 'Annapolis, MD', 'Atlanta, GA', 'and', 'continue', 'the', 'list', ..... ); $parent = $pages->get('/cities/'); // assumed that you have a cities parent. foreach($cities as $city) { $p = new Page; $p->parent = $parent; $p->template = 'city'; // choose a valid template for this $p->title = $city; $p->save(); } (written in the browser, but simular concept I have used often) -
Return validated & cleaned selector string.
Martijn Geerts replied to Martijn Geerts's topic in API & Templates
I didn't thought about id= template= limit, end, include, parent, children etc. Oops, this thing needs some more time. Maybe someone more experienced can take a better look on this.