Leaderboard
Popular Content
Showing content with the highest reputation on 09/12/2016 in all areas
-
php supports mssql connections, easier from a windows php server than from linux but available for both. You can certainly access mssql databases from php though. Take a look here for starters: http://php.net/manual/en/ref.pdo-dblib.php Be aware there are sql differences between mssql server an mysql server, so you may run across data conversion issues between the two database servers. For example: http://stackoverflow.com/questions/30739204/how-to-convert-mssql-to-mysql-date-in-php4 points
-
You can now also add your own features to the User Bar: In this case it's a link to Google Page Speed for the current page, but you might choose to link to a specific page in the PW admin, perhaps a ListerPro page - maybe bookings or orders, or whatever you want. An SVG icon is probably the easiest approach, but it's up to you. The entire thing is rendered from custom php code that you enter in the config settings. You can make use of the $iconColor variable in your code to have it match the icon color you defined in the Icon Color setting. Of course you can return multiple icons with this code block. By default, all logged in users who don't have Tracy Debugbar permissions we see these custom feature icons, so you may wish wrap this in a: if($user->hasPermission('page-edit')) {2 points
-
Some years ago, (maybe 10 ?), I worked with a nice and useful tool: Tiny But Strong. It is a OneFileTemplatingEngine in PHP, with 1 PHP-class, 6 methods and 5 properties. If I recall right, I was able to do every thing with it. Besides Tiny But Strong, it also was Simple And Easy To Use. It is under constant development / maintenance since 2004!2 points
-
@Robin S Your code will not work the naming format of a repeater page is based on microtime. You maybe talking about the parent. The format is 'for-page-1234' Unfortunately FILTER_SANITIZE_NUMBER_INT will not remove the dashes (minus). To get the page where this repeater item lives you can go this way: $mypage = $pages->get('id='.ltrim(strrchr($page->parent->name ,'-'),'-')); // the page where this repeater item lives2 points
-
2 points
-
@LostKobrakai and @pwired Thanks for directions. I'm going to have a busy day this Monday, but will definetally take a closer look of the posts you provided. Note, that I've already adopted @clsource's (Camilo Castro's) wire render pattern thanks to his recently released Processwire Ghost Writer profile which I am currently refactoring to my needs. @tpr Well, there are various reasons for not taking the template engine path, at least not yet. You have almost converted me and I was about to jump the Latte bandwagon, but currently I want to work with the least amount of dependencies and a template engine is just another framework to add to he system which is not really needed for standard, basic websites which I'm currently interested in.2 points
-
That is something that pops up every now and then and certainly is something to think about. However Processwire's API does already just the same, but offers more flexibility and possibilities. https://processwire.com/talk/topic/1403-template-engine/?do=findComment&comment=126262 points
-
@Jonathan Claeys Please provide an example of the code you are using to try and get your media image URL. I haven't used Media Manager, but looking at the documentation for outputting to the front-end there are a couple of things to be aware of: 1. A Media Manager field returns an array (specifically a 'MediaManagerArray') so you need to treat it as such in your template even if it contains only a single media item. The docs suggest looping over it, but if a MediaManagerArray is also a WireArray (the docs aren't specific about that) then you could use other API methods to get items such as first() or get($key). 2. The media itself (an image in your case) is contained in the media property of an individual MediaManager object. So you need to use methods like url or size() on the media property and not on the MediaManager object. Assuming that a MediaManagerArray is a WireArray and that your Media Manager field is called my_media_field: $media_manager_array = $page->my_media_field; $media_manager_object = $media_manager_array->first(); $image_object = $media_manager_object->media; $url = $image_object->url; echo "<img src='$url'>"; This is just to give you the idea, and is more verbose than necessary.2 points
-
Hi there fellow kiwi Check out the Page List Show Page Id module - it's very simple so it's easy to modify to include whatever information you want in the page label. You can add some custom CSS to hide/style the added info: public function init() { if($this->user->isSuperuser()){ $this->addHookAfter('ProcessPageListRender::getPageLabel', $this, 'addPageIdLabel'); // add stylesheet $this->config->styles->add($this->config->urls->PageListShowPageId . "PageListShowPageId.css"); } }1 point
-
no, i don't think i ever mentioned it; it's just sort of a part of this ad-hoc sub-framework i use for developing sites..., and came into being way before Tracy was born... I do use it extensively since it would show for non superadmin under circumstances where Tracy might be confusing; this one is super simple and just shows a handful of links to the site editors/managers.. on the next project, i am going to pursue using Tracy instead of this, and i'll post back here in terms of how it works out with using the php code...1 point
-
wow, that officially makes my custom admin bar obsolete... would probably just put a function call there and then hook into that function on a template-by-template basis (e.g. some templates need specific links - if there is a feed, then i put a feed validator, if there is schema, i put a structured data test... )1 point
-
I use this module on a daily basis and have no problem with it working on PHP 7. The fact that newer versions of PHP are "more secure", to me is not a "problem" but a commendable thing. Maybe I'm missing something, but the fact that this module is working on PHP 7.x with the changes made back in June (when I reported a problem), leads me to think that if there is any problem, it would be in the setup of the cronjob that the user @Werner Pelnei was using. I originally had problems with the cronjob, but was able to to get it to work with PHP 7.x /usr/bin/curl -s "https://www.mywebsite.com/?hash=aaaa----secret-hash----aaaa" > /dev/null This statement was what finally worked. I just hope that the module works and doesn't circumvent needed security parameters introduced in newer PHP versions. I don't want to have to stop relying on the functionality that this module gives me. As I stated earlier, it works (without any needed new changes to the flourish library in the module) with PHP 7.x1 point
-
I haven't used it either but have thought about contributing to this particular module (since I've done work with fMailbox.php). As long as I've followed ProcessWire I still have yet to have a production website developed with it under my belt...but that will "soon" change. At that point I'll be better able to contribute.1 point
-
Thanks for your post @BrendonKoz - I have never actually used this module, despite contributing a fair bit of code to it, so I haven't really been pushed into finding a solution. I'd love to hear from @Werner Pilnei whether he has success with your version of fMailbox.php - if it solves his problems then it sounds like it might be the best solution for now. Thanks again!1 point
-
Just happened across this while randomly perusing (since I love the work Jason and Pete did with this). I have an updated version of the fMailbox.php class in my github account that may solve some of these issues. Technically speaking, the "problem" is that newer versions of PHP are much more secure, and so when connecting to mail servers it's *actually* checking validity of certificates and credentials and what-not. The quickest way to get things working is to fall back on how PHP used to work -- no security checks. My fMailbox.php version does that. It's not the best solution, but determining exactly how to get fMailbox to properly work with all variations of servers, certificates, credentials and what-not was just not working out too well for me. In terms of a good PHP mailbox checking library, I've found that Flourish seems to have one of the best even if it is primarily a dead project. https://github.com/BrendonKoz/flourish-classes/blob/master/fMailbox.php There have been various GitHub users that have all forked the Flourish library and provided pull requests. I've seen some and added the few fixes that (1)I hadn't already added, or that (2)didn't conflict. That said, there have been others that have been much more active in maintaining their fork than I have.1 point
-
Make sure you're setting the content-type header, otherwise jquery will handle it as plain text instead of json.1 point
-
Just return json directly like so: http://stackoverflow.com/questions/4064444/returning-json-from-a-php-script1 point
-
Hmmm, not to be too sceptical about server admin competence, but it might be worth enquiring about the mySQL slow query log. It is my understanding that they should be able to identify the source of this kind of problem.1 point
-
1 point
-
Warning: it's going to be TL;DR so proceed with caution In an effort to come up with an optimized development workflow, I have come up with the idea of implementing most of the required template files in the form of static HTML files first (based on a "CSS framework" which will also serve as the CSS base of the site). Basically I want to implement most of the frontend without touching ProcessWire in the first place. The advantage of this approach is that it is a lot faster to work with only HTML/CSS/JS during the frontend design phase of the project, and the end result of the design phase can be "similar" to a wireframe/mockup which can be presented to a client, but this "mockup" actually represents (say) 80% of the final design, so it is something that is rather good to work with when the backend development with ProcessWire begins. This also means that my ProcessWire template files will be mostly implemented with <?php echo ... ?> and alternative syntax control structures that can be "just injected" into the above mentioned static HTML template files to turn them into ProcessWire template files later on. So far so good, but my ProcessWire template files are going to be separated into "template file partials", and I also want to implement the static HTML template files in the same way, so that they are also separated into "template file partials", and ideally organized in the very same structure. E.g. I will include the site's navigation in the ProcessWire template file like this: <?php echo $navigation ?> So I want to do the same in the corresponding static HTML template file, something like this: <div data-template="partials_navigation"></div> If it can be done recursively, then I can implement the same in both cases. With ProcessWire, I use wireRenderFile() to render partials recursively, so I just had to figure out what to use in the case of the static HTML template files. What else to use if not JavaScript? I started off by googling around, looking for some pre-made solutions... I did not find too much that could help me, the only thing useful I could dig up is "HTML Imports", for example: http://blog.teamtreehouse.com/introduction-html-imports Note, that currently this technique only works in Chrome(-ium), but that is my choice in frontend development anyway. I've read somewhere that other browsers might never implement "HTML Imports", but that is to be seen... I have found a lot of articles explaining the basics of "HTML Imports", but I could not find any libraries or frameworks nor even something similar to what I need, so I implemented a proof of concept version of mine: I'm quite happy with the result so far. The JavaScript code needs some additional error handling, but otherwise it seems to do what I need. Here it is in action (Chrome(-ium) only!!!): [...no longer live...] And here is the source code for those who want to take a closer look: [...old stuff, I removed it to save space...] However, I'm pretty sure that someone must have already come up with this idea, so I'm asking the ProcessWire community if anyone can point me to similar solutions, something that I can study and/or use. So any piece of advice that might help me to take it to the next level, or any objections to this "HTML Imports" technique, any disadvantages? Thank you in advance1 point
-
cstevensjr and Doug G, thank you both very much for response and useful links! Now I know where to start studying. Thanks again and have a nice day!1 point
-
It's a module that adds extra color variation to Reno admin theme. Maybe someone will find it useful. Features (can be disabled or enabled): Sticky header with action button always visible notices at the bottom fixed sidebar Disabled accordion on Pages and Setup domain name with "open home page in new tab" Not tested with Admin on Steroids. Usable with disabled all option in this module and enabled sticky compact header in AdminOnSteroids. Not everything in every combination play well, but should be ease to set up these modules together. Before install change admin theme to Reno (works best with blue colors but is usable with Reno and classic) and this module will do the rest. The good idea is to change admin theme for guest as well to enjoy matching login screen. https://github.com/pmarki/Processwire-Admin-Dark-theme1 point
-
I had a crack at this and it seems the answer is "yes". Here is example code you could use in the ""Custom PHP code to find selectable pages" for Page field 2: $pid = filter_var($this->name, FILTER_SANITIZE_NUMBER_INT); // get repeater page id from inputfield name $p = $pages->get($pid); // get repeater page if($p->id) { $parent = $p->page_field_1; // get value of first page field if($parent->id) { return $parent->children(); // return children of selected page } } But the bad news is that dependent Page fields only auto-refresh when using "Custom selector to find selectable pages" and not when using "Custom PHP code to find selectable pages". So you would need to save the page after selecting a value in Page field 1, which kinda sucks.1 point
-
I just tried the repeater solution but as you always have to add at least one item to see the input fields it's really not a solution. It's just not easy enough for the end users as they do not see the field immediately. In my opinion we would need something that looks like the fieldset-type (maybe even with an option to show it as seperate tab instead of fieldset) and behaves like the repeater (one field, that contains several other fields). Would it in your opinion make sense to replace the FieldtypeFieldset with a new FieldtypeGroup?1 point
-
Looks like it works fine with AOS, thanks! There was 2 light lines in the header that I just removed from AOS. FYI, If you need to style something differently for AOS, you can use 'html.aos {...}' in your CSS (or 'html:not(.aos) {...}').1 point
-
I think ditching template engines for what you're trying to do is probably not a good idea. You want to fill in html templates with various data. Static in the first place and dynamic in a second step. That's exactly what templating engines are made for and you'll probably not come far without at least implementing something like a small templating engine on your own. But a own implementation does also need own maintenance and documentation and so on and it's probably not as powerful as existing solutions. They may be a additional dependency, but really a own library is a dependency, too, which is just harder to maintain.1 point
-
I always wonder why u guys don't use a template engine instead. Most things you try to achieve are already there and on a more sophisticated/bulletproof level, and there are many more goodies. Ok, it takes some time to get familiar with them but the productivity boost they give is worth the effort imo.1 point
-
Since the introduction of the delayed output strategy by Ryan this has been discussed in many posts and I have used it ever since and I have fine tuned it until perfection. https://processwire.com/talk/topic/8767-regarding-delayed-output/ https://processwire.com/talk/topic/11199-mainphp-inflexibility/ using wireRenderFile() in the delayed output strategy https://processwire.com/blog/posts/processwire-2.5.2/ https://processwire.com/talk/topic/11836-wirerenderfile-on-child-pages/ Here Camilo Castro explains how his wire render pattern works: https://medium.com/@clsource/the-wire-render-pattern-806bf6d6097a#.jquhbxejn https://github.com/NinjasCL/wire-render-pattern Horst came up with the idea to use $Layout for using different layouts for any given page on the front https://processwire.com/talk/topic/8767-regarding-delayed-output/ https://processwire.com/talk/topic/11769-delayed-output-and-another-layout/ with this I call html files in a folder "views" for front pages who need a different layout Then I used your own former mentioned strategies here: https://processwire.com/talk/topic/2311-processwire-on-the-web/page-21#entry109766 https://processwire.com/talk/topic/11809-pw-site-profiles-are-like-wp-themes/#entry109848 https://processwire.com/talk/topic/2311-processwire-on-the-web/page-21#entry109851 Together I am using this here as an example set up in my _main.php file: (the variables shown here are not always the same but depending on what a web site needs) <?php include("./banner/{$banner}.php"); ?> <?php include("./topnav/{$topnav}.php"); ?> <?php include("./subnav/{$subnav}.php"); ?> <?php include("./slider/{$slider}.php"); ?> <?php echo $layout; ?> <?php include("./footer/{$footer}.php"); ?> Any value for css, js, values, etc for a specific page on the front can be over rided, switched on or off as desired on each associated template file. Further I use separate css files for the main part of a web site and individual css files for front pages where needed and call for them between <head> and </head> with $variables on the associated template files. Output happens with the $Layout as mentioned before. Values used site wide are set in the _init.php file and can be changed or switched on or off as needed on the associated template files. This makes it all highly organized and fast maintainable. Reading through your proposed workflow looks like I am already are applying that. Would be interesting to find out how and where your proposed workflow would improve on my current workflow.1 point
-
You should probably take a look at this one: https://medium.com/webdevs/living-styleguide-mit-fractal-und-processwire-e900f05e0b79#.vij9p35p8 (I know I should translate it some time, but I heard it's quite readable with google translate)1 point
-
I don't believe it has been explored for maybe the following reasons: (1) I would look first at the stated requirements for ProcessWire https://processwire.com/about/requirements/ It should be noted that it says that MySQL is required (or any MySQL compatible database i.e. MariaDB) (2) Furthermore, I don't believe anyone has explicitly said that it technically can't be done, however you first need a good understanding of the differences between MySQL and SQL Server (MSSQL). Then you would need to account for these differences in your code. http://www.databasejournal.com/features/mysql/mapping-data-types-between-mysql-and-sql-server.html http://www.databasejournal.com/features/mysql/comparing-sql-server-and-mysql-functions.html (3) Additional vital information regarding Microsoft Infrastructure (Database technology), in case you want to pursue getting this to work https://www.microsoft.com/en-us/download/details.aspx?id=20098 http://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/install-the-sql-server-driver-for-php (4) Additional information regarding Microsoft Infrastructure (Web Server technology) which will always be applicable when working with Windows solutions http://www.iis.net/ There is much information (provided before) about using Microsoft technologies (specifically IIS working with MySQL) to enable working with ProcessWire. They work without changing coding standards and I believe many people are using these solutions successfully. BTW, .Net is a Microsoft technology and framework1 point
-
It's probably as simple as temporarily disabling this language inheritance for each field only for the request, where you're building the list. foreach($multiLangField as $f) { $f->langBlankInherit = LanguagesPageFieldValue::langBlankInheritNone; } // Check all your fields // Make sure non of the fields is saved before exiting1 point
-
There is a new version of the module, as tpr suggested all features are optional. Now works in AdminOnSteroids, but: - you can have turned on sticky header in only one module (though in AdminOnSteroids must have sticky compact), - if you have AOS header "Show host name" doesn't work - if you have DarkAdmin header "Always show search field" should be disabled and "Place header button next to title" should be enabled - probably other small glitches, but overall should be usable.1 point
-
@benbyf I forked the module and added the functionality, you can find the module at github: https://github.com/flydev-fr/MarkupTwitterFeed To search hashtag use it as the following : $options = array( 'searchQuery' => 'ProcessWire', 'limit' => 3 ); $t = $modules->get('MarkupTwitterFeed'); $out = $t->search($options); echo $out; The function search() act like render(). Thanks again for the suggestion (searching for hashtag). I think we can improve it a bit, let me know for any needs.1 point
-
1 point
-
Thanks alot, I just saw my problem. I didn't see you had to call the method ->media also after you got your image field already. That solved the problem.1 point
-
1 point
-
1 point
-
1 point