Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/27/2015 in all areas

  1. A friend showed me this https://regex101.com
    5 points
  2. If you don't use it already, try http://regexr.com/ for testing your regexes, I learned a lot about regex with that tool. It only supports JS regex (obviously), so not all regex features that PHP can handle are supported, but still. If succeeded I save it on regexr and put the URL in a comment within my code, so I can revisit and/or change it later. The great thing is, not only does it save the regex but also the string/text you were testing the regex with.
    3 points
  3. Well I got my brand new pi2 all loaded up with mysql and apache, this thing is great! I have it shared through my dyndns if you wanna give it a try. I just have the bluevr profile loaded on processwire. Credentials are: admin / password. go to: therestaurant.endoftheinternet.org
    3 points
  4. Just add .xml to the name ans disable trailing slashes.
    3 points
  5. @renobird I guess the name is what killed your CRM project)) Something with that name just can't be right.
    2 points
  6. @Pete Untested and a little verbose, but you could try this... $m = array(); $operators = array('=', '!=', ... ); // expand as needed depending on your expected operators $operators = array_map('preg_quote', $operators); // preg_quote them all $operators = implode('|', $operators); // join as alternates if (preg_match("#\{showif (?P<field>[\w\.]+)(?P<op>$operators)(?P<value>[^}]*)\}(?P<body>([^{]*))\{\/showif\}#i", $selector, $m)) { $field = $m['field']; $op = $m['op']; $value = $m['value']; $body = $m['body']; // You could just access $m directly - but I've made it explicit } else { // No match stuff } I might have misunderstood the literals in your example though. If you want to capture possibly multiple occurances in a string then you could use preg_callback or preg_match_all - but I don't know the ins and outs of your use-case so I've left it at a single match. The actual regex may need a little tweak and can be simplified if you don't need to match anything in the text up to the {/showif}.
    2 points
  7. This might be overkill, but if you really want custom output functionality and a default output if no property is accessed directly for a field you could create a FieldtypeTwitter extends FieldtypeText first, create a TwitterData class, save it in your module's directory as TwitterData.php <?php class TwitterData extends WireData { protected static $urlPrefix = 'https://twitter.com/'; // for echo $field; directly public function __toString() { return "@{$this->handle}"; } // for echo $field->url; public function __get($name) { if ($name === 'url') { return self::$urlPrefix . $this->handle; } else { return parent::__get($name); } } // this is some advanced functionality, you might not need it // isset($field->url) returns true only, if 'handle' not empty public function __isset($name) { if ($name === 'url' && $this->handle) return true; return parent::__isset($name); } } Then overwrite the formatValue method in your FieldtypeTwitter.module: <?php // require the TwitterData class from wherever you put it require_once(__DIR__ . '/TwitterData.php'); class FieldtypeTwitter extends FieldtypeText { public function ___formatValue(Page $page, Field $field, $value) { $twitter = new TwitterData(); // the value that comes from the field $twitter->handle = $value; return $twitter; } } Now in your template, you can use it like you stated above: echo $page->twitter; // outputs @accountname echo $page->twitter->url; // outputs https://twitter.com/accountname Just tested, it works like intended. I used the same method on my FieldtypeYaml
    2 points
  8. I was thinking about launching a new CRM and calling it Vista — I don't see the problem.
    2 points
  9. Hein?? Why the hell did they call their product Fedora? Edit: to be clear, I don't have a problem with the name itself, but that it's the same as the linux distro.
    2 points
  10. Just wanted to post it here for others that might look for an example. I'm currently working on importing a Site to PW2.1. Following code I figured is needed to create pages using the Bootstraped API: <?php include(./index.php) // bootstrap PW $p = new Page(); // create new page object $p->template = 'page'; // set template $p->parent = wire('pages')->get('/about/'); // set the parent $p->name = 'mynewpage_url'; // give it a name used in the url for the page $p->title = 'My New Page'; // set page title (not neccessary but recommended) // added by Ryan: save page in preparation for adding files (#1) $p->save(); // populate fields $p->image = 'path/to/image.jpg'; // populate a single image field (#2) $p->images->add('path/to/image1.jpg'); // add multiple to images field $p->save(); // testing echo 'id: '.$p->id.'<br/>'; echo 'path: '.$p->path; Note: in PW 3 with multi-instance support adding new Objects https://processwire.com/blog/posts/processwire-2.6.21-upgrades-comments-more-on-pw-3.x/#more-updates-on-processwire-3.0 [Edit by Ryan #1] Added first $p->save(); [Edit by Ryan #2] Changed $p->image('...') to $p->image = '...';
    1 point
  11. Hi All, I am gladly posting my first site profile. Blue-VR Site Profile for ProcessWire Summary A site profile for corporate or personal website. Profile can be used with ProcessWire open source CMS/CMF version 2.3+. The front-end uses the Bootstrap 3.1 css framework for to get the responsiveness and mobile friendliness. Front-end Demo - bluevr.webcreate.lk Back-end Demo mode - bluevr-webcreate.lk/processwire (The username 'admin' and password 'bluevr2') Overall features * HTML5 & CSS3 + ({less}) * Build with bootstrap 3.1 * SEO Friendly * Clean & modern design * Responsive markup * Contact form and google map locations with multiple google markers * Testimonials using bxSlider * AIOM supports (Just install the module no need to touch the code) How to install Please take a copy of the latest ProcessWire (Replace the install, modules and templates directories with those in this profile, as shown below: - /site-default/install/ - /site-default/modules/ - /site-default/templates/ Make sure you do following steps as well 1. Add `tinymce` directory into /site-defaut. 2. Add the following two lines to your `/site/config.php` file: $config->prependTemplateFile = '_init.php'; $config->appendTemplateFile = '_main.php'; Download Github: https://github.com/gayanvirajith/BlueVrSiteProfile/ Credits I would like to thanks Ryan for giving us great CMS/CMF and modules. Hani AbuGhazaleh for a great module of Fieldtype: Select (AKA Drop Down) David Karich for providing such a nice module AIOM+. *** Please note that the site profile is still on testing stage. Thanks ------------------------------------------------------------------------ Edit: install instructions. Edit: Add credits Edit: Update live demo url Edit: Update back-end demo mode details
    1 point
  12. https://github.com/ocorreiododiogo/pw-image-fields-markup http://modules.processwire.com/modules/textformatter-image-field-markup/ This is an old idea that I felt inspired to finish after reading this discussion https://processwire.com/talk/topic/9164-release-inputfield-ace-extended/?p=88717 This textformatter does more or less the same that my Image tags texformatter, but instead of using it's own tags, it tries to be completely agnostic while doing this, so you can use whatever method the markup language applied to that field uses. So, for example, If you are using Markdown on your that field, you would insert all images of a field called "images" on that page with: ![](images:0) or inserting the second image from the field called "images" with and alt text of "overriding alt text": ![overriding alt text](images:2) While for textile you would do this: !images:0! !images:2(overriding alt text)! As I said, this is language agnostic, so it should work with any markup language. The trick is to collect the images when they are already html img tags, and intervene only on those that are not urls by changing their attributes accordingly. I used the php native DOMdocument class for this. There are still things to be done, like targeting fields on other pages, defaulting to the first image field from that template and cleaning up a bit. But I'm not planning to do those at this point. Consider this beta.
    1 point
  13. I'm building a website that creates pages, sets the template and once a payment has been processed the page needs to be set to published. I need to know how to set this in the PHP Page class. Is it just $page = new Page(); $page->published = FALSE;? I couldn't find out how to do this in the docs. Thanks Clint
    1 point
  14. As some may now, the admins on tuts plus declined making a course on processwire :C Here´s the link http://tutsplus.uservoice.com/forums/248750-what-would-you-like-to-learn/suggestions/6769150-using-processwire-for-web-development So, Maybe we should make our own course?. I found this website for making such courses. https://usefedora.com/ I hope someday, more people will know the joy of processwire
    1 point
  15. I've a small problem with insertBefore. Somehow it's not working, while I can't see what could be wrong. I'm hooking the FormBuilder Interface and "form_emailForm" is correctly changed to 50% width. If I plainly add the additional field I see it below the whole interface, but if I use insertBefore it's not even to be found in the markup. Also $form->get("fieldsetEmail") does return null, even though this is the parent InputfieldWrapper of form_emailFrom. PW Version is the 2.5.20 public function addEmailField($event) { $form = $event->return; $field = $form->get('form_emailFrom'); $field->columnWidth = 50; $additionalField = $this->modules->get("InputfieldEmail"); $additionalField->columnWidth = 50; $additionalField->attr('id+name', 'form_defaultEmailFrom'); $additionalField->attr('value', $form->defaultEmailTo ? $form->defaultEmailTo : ''); $additionalField->label = $text; $additionalField->description = $text2; $form->insertBefore($additionalField, $field); }
    1 point
  16. I USED the saveXML() in ImagesManager parser.
    1 point
  17. Should work like this $field->addOption(value, label, attributes); $field->addOption(123, "Produkt1", array("disabled" => "disabled"));
    1 point
  18. YOu might consider using the new formatValue(page, field, value) method in textformatters? https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/core/Textformatter.php#L62 I had some strange things with DOMDocument in the past with encoding and I hate it cause a saveHtml() does return the a modified html structure with adding a <html> etc.
    1 point
  19. @Pete HTML tags can be a pain. You could try this... "#(?<popen>\<p\>)?\{showif (?P<field>[\w\.]+)(?P<op>$operators)(?P<value>[^}]*)\}(?P<body>([^{]*))\{\/showif\}(?P<pclose>\<\/p\>)?#i" ...but I can't recall of the top of my head if $m['popen'] and $m['pclose'] will be unset, null or just an empty string if they do not match. You may also want to allow for possible linebreaks between the open and the {showif} and between the {/showif} and the close. Finally, will there be stuff like classes on the p tag? If so then you need to use something more like... (?P<popen>\<p[^>]*\>)? ...to try and match the open tag Ok, got to go. Will look in on this again this evening.
    1 point
  20. Techy note... If you know the delimiter for any part of an expression then it's faster to tell the regexp parser explicitly when to end a run than have it try to work it out. So this bit... \{showif:.*?)\} ...can be speeded up by telling it to match until a '}' char... \{showif:[^}]*)\} ...and you don't need to worry about embedded line-breaks or greediness then either as that part will stop matching when it hits the first '}' with no backtracks. Edited to add: Actually the speed-up shouldn't be a lot in this case as you are using an ungreedy match - but it would potentially be big if you had greedy matches.
    1 point
  21. I am not as hopeless as I thought. This: {showif::field=value} some text {/showif} Can be captured with this: preg_match_all("/\{showif:.*?)\}(.*?)\{\/showif\}/is", $input, $matches); My next trick will be matching if the {showif} tags are optionally surrounded by paragraph tags, but I have a workaround for that so no real need to fix that right now.
    1 point
  22. Maybe have a good read on the module itself? https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Markup/MarkupPageArray.module
    1 point
  23. Maybe you could check if there's something in MySQL logs. Also if you don't have slow query log enabled it could help you identify problem. I use Zend Server's Z-ray for debuging and development because there's a great feature that tracks every query made on page, in dev server ofc. So that might also help you to identify the problem.
    1 point
  24. @MuchDev Seems pretty responsive, would fly with ProCache.
    1 point
  25. I was just reading this post on how to make breadcrumbs in ExpressionEngine (http://bit.ly/hello_crumbly) and how you basically have to resort to a plugin to do it for you. It reminded me of some of the problems I had with EE when I was trying to use it and develop in it awhile back. One being that URLs aren't a primary/unique key to a page, natively in the system. Imagine ProcessWire with only it's root level pages and url segments, and that gives you an approximation of what you have to deal with in EE. I'm not saying it's wrong, but it's a different approach, and one that I found frustrating to work with. The post also made me realize I didn't have anything on the site demonstrating how you might make a breadcrumb trail (other than in the default site profile). It's really a simple thing (at least, relative to EE), so figured I'd post here. : <?php foreach($page->parents() as $parent) { echo "<a href='{$parent->url}'>{$parent->title}</a> "; } You may want to output those as list items or add some >> signs between items, but as far as code goes, the above is all there is to it. What it's doing is just cycling through the current page's parents till it reaches the homepage. Lets say that you also wanted to include the current page in your breadcrumb trail (which is probably redundant, but some sites do it). What you'd do is just append it to the list of parents that gets cycled through: <?php foreach($page->parents()->append($page) as $parent) { echo "<a href='{$parent->url}'>{$parent->title}</a> "; } The reason this is so simple is because every page is anchored to a specific URL and those URLs are representative of the site's actual structure. Pages in PW are actually uniform resource locators (URLs) whether on the front end or the back end. Because of that, there's no guesswork or interpretation to be done. In EE and Drupal (as examples) that data does not natively live at a specific URL. Instead that data is off in a separate container and the ultimate URL (or URLs plural) where it lives–and will be presented by default–are not as cut and dry. Yes, you can install plugins or go through strange taxonomic/channelistic/cryptic trials to approximate the behavior in other systems. And yes you can use url segments and pull/render any other pages you want in ProcessWire according to your own needs. But I'm talking about the fundamental and core system differences. This difference goes far beyond simplicity of generating breadcrumbs–it is a factor that translates to simplicity throughout the API.
    1 point
  26. DatabaseStopwords.php and https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/DatabaseStopwords.php#L83 Maybe something like: DatabaseStopwords::remove("about"); in the config.php or on top of a / the search.php ?
    1 point
  27. Not sure you have seen this? Module: TextformatterTwitterReplace https://processwire.com/talk/topic/8868-module-textformattertwitterreplace/
    1 point
  28. Hey, in a recent discussion we talked about one body field vs. PageTableExtended (or similar content splitting). Because of this I created a little Proof-of-concept including a CKEditor plugin and ProcessHannaCodeModal.module. As I don't have a lot of spare time in the moment (because I'm going on vacations for five weeks on monday So I have spare time but no computer to continue working on this ) I thought I share the current progress with you. Feel free to use those files to continue working on it or something similar. Here's a little screencast (I'm using the "lightwire" CKEditor skin in it): And here are the files: HannaModal.zip
    1 point
  29. Hey, I would like the repeater to fully support view dependency. At the moment it works sometimes. Sometimes the new values won't get saved after hitting the save button or the field will be shown the whole time. It would be enough if the "=" comparator would be supported completely. I know this hacky solution where you have to uncomment the following code in config.php (even if I don't know exactly how it works): /** * Settings specific to InputfieldWrapper class * * Setting useDependencies to false may enable to use depencencies in some places where * they aren't currently supported, like files/images and repeaters. Note that setting it * to false only disables it server-side. The javascript dependencies work either way. * * Uncomment and paste into /site/config.php if you want to use this * * $config->InputfieldWrapper = array( * 'useDependencies' => true, * 'requiredLabel' => 'Missing required value', * ); * */ But even with this set to false it sometimes stops working... It would really important for my current content creation model: I use "content section" repeater where you can choose the type at the top (normally "text" and "image(s)"). So the body field only needs to be visible if "text" is selected and same for the images field. At the moment I don't know a solution to handle this smarter (maybe PageTableExtended but haven't tried it that far). So ... yeah that's my wish Thanks, Nico
    1 point
  30. I completely agree, except it should be PageTableExtendedInline - to me that would be a great interface - need to think about how complicated this might be to put together I also don't like the modal approach of PageTable - that is definitely where repeaters have the edge - that said, repeaters have too many limitations so I don't ever use them.
    1 point
  31. @Sevarf2 The notice about the undefined index is fixed now in FieldtypePageWithDate v1.0.3 https://github.com/Rayden/FieldtypePageWithDate
    1 point
  32. Modx going to make use of PSR standard and composer. Have anyone had a read ? https://medium.com/@drumshaman/keeping-modx-relevant-part-one-42dc6632f86b https://medium.com/@drumshaman/keeping-modx-relevant-part-two-15a37eab5b48 I do believe 3.0 should have bought some of these into lights.
    1 point
  33. Kongondo has it right but why not use the power of processwire and just leave the rte for what it is. You can upload your images directly in the admin of processwire. Edit instead your template and pull the image directly from a field. https://processwire.com/api/fieldtypes/images/
    1 point
  34. Like kongondo described images are in PW a kind of ressources/objects in a page template or if you want a image could be a single page, too. There is no right or wrong way - PW let the choice up to you how do you use images or let your editors use images. so you have a few options to go: 1. give your template a imagefield (single or multiple images) user can choose from this images in the content or from other images on other pages 2. build up a little gallery structure (you could use some hints/links from this post scroll down to the image things https://processwire.com/talk/topic/7836-cant-wait-first-project-with-pw-nearly-finished/) -image-root --image1 (single image field) --image2 (single image field) => maybe use this one to change the image parent for the imageselection in the CKE https://processwire.com/talk/topic/3023-module-ckeditor/page-10#entry71674 3. Soma's image manger solution https://processwire.com/talk/topic/3219-images-manager-beta/ xxx many other ways to get there in PW The first one is the easiest way to go. Best regards mr-fan
    1 point
  35. You cannot upload images directly like that...See the message in the 'green' info bar. Add an image field to the template that page is using then add an image to it to be able to select it in the RTE. Alternatively, see the text below the 'green' info bar about uploading images from other pages...
    1 point
  36. Hi Christophe, Please refer `site/templates/_functions.inc` file. Inside of that file there is a method named `getContactUsForm()`. At the moment `from email address` would be your admin email address. Please feel free to modify it in `getContactUsForm()` method. Thanks
    1 point
  37. @kathep Well, I like to have a little bit of work to justify getting up in the morning. My workflow kind of goes like this: I copy my default of installation of processwire. It has SEO built in, a half built mini-blog/news system in there and the complete tool kit (that list is only the minimum, there is lots more). I then have a folder called elements which has bits of layout ready to go - wide panels, multiple boxes and that sort of thing. It gains bits occasionally. I start up sublime and Prepros and a web browser. I then sit down, pour a coffee and say, "what am I going to copy and paste today?" Then I go and write some music for someone. I think I might have concentration issues.
    1 point
  38. I suggest that whatever you do you stay away from any fixed scaffolding framework. The point of ProcessWire is that people can use whatever layout structure they want. For instance, many like Bootstrap and Foundation as complete solutions, but many others find them large and cumbersome and too limited. If you have a large framework with lots of JS and CSS and then people want different JS for different slideshows or product display and so on, you can end up with an inflated beast. So, I would suggest you stick to the functionality in a very agnostic way and make sure it is done in such a way that people can create the template files it as they wish.
    1 point
  39. A recent request of a client who we are porting (and in parts redesigning) a WordPress website to PW for, made me get into the eCommerce topic again–and lead me here again. I’m actually pretty sure one (or we?) could build a pretty powerful eCommerce framework on top of our beloved PW. Imagine an architecture that follows the principles and ideas of PW. Simple shop API (like $pages, $languages, $users you get $products or $shop in all your templates, etc.), completely modular: basic shop module as framework, implementing products page class, cart, checkout skeleton; more specific functionality is implemented through modules which hook into the framework (like a tax module would implement tax classes and be hooking into price calculations; payment modules would all hook into the checkout process the same way etc.). As soon as a basic shop framework would be available as a base module taking care of the basic stuff, developers could focus on very specific challenges (payment, stock management, etc.). I think I said it before: PW in my opinion misses two or three powerful modules/module packs that would open new doors two a broader adoption among web devs. One example is a really flexible eCommerce pack that turns PW into a shop/catalog, another is a easily customizable community pack with nice user management, registration, password recovery, log in stuff. Ah, and version management of course! Still, I wonder what today would be the best way to go if I wanted to build an online shop and embed/implement it in PW. Reading this thread made me shiver with fear!
    1 point
  40. Ah sorry, a form object is a InputfieldWrapper which is a special Inputfield, but it has Inputfields that are part of the InputfieldArray (defined at top of /wire/core/InputfieldWrapper). That's why replace(a,b) is not there for a form object. No you don't have to set it, just modify the field object and done, it's an instance and not a copy. Just as a hint. When doing all this form manipulation, just keep in mind that fields could be nested in case of fieldsets containing fields. There's also $form->get("fieldset_details")->children() etc... But you could also get a flat presentation of the inputfields with $inputfieldsArray = $form->getAll(); though not positive it's useful in your case. That should work fine.
    1 point
  41. Yah as you speak $form->get('field') or find.. Basically it's a WireArray. Rings a bell?
    1 point
  42. @=>n0sleeves, something not mentioned here before: - abantecart - http://abantecart.com/ecommerce-features Don't even know where to start, a very impressive and still easy admin, it even has the complete layout editable in the admin by letting you edit simple blocks of code, something that I pointed at before, not so long ago. Very clean and clear coded. Supports hooks. Self-hosted? yes - scalable? yes - extensions in separate folders? yes. Templates easy editable to change the front to your personal taste? yes. Forked or cloned from opencart? no. Has new engine, architecture and concepts. A shop system dream come true for both designers and coders. Is it really that good? yes - like the cms/cmf dream came true with processwire. Foxycart - opencart - prestashop - xyzcart ? ? => all history with abantecart. I know this will raise unbelieve and criticism, therefore I suggest to download, install, and see it happen for your self. Let me know if this was useful for you.
    1 point
  43. Ups, almost forgot about them. *hidesinthecorner*
    1 point
  44. The page statuses are a bitmask so it's possible for there to be multiple statuses on a page, like unpublished and hidden. So it's best to add and remove statuses with the addStatus and removeStatus functions, i.e. $page->addStatus(Page::statusUnpublished); // same as: $page->status = $page->status | Page::statusUnpublished; $page->removeStatus(Page::statusHidden); // same as: $page->status = $page->status & ~Page::statusHidden; You can also check the status of a page by using the is() function: if($page->is(Page::statusUnpublished)) { ... } // same as if($page->status & Page::statusUnpublished) { ... }
    1 point
×
×
  • Create New...