-
Posts
2,951 -
Joined
-
Last visited
-
Days Won
20
Everything posted by szabesz
-
Hi, I have not read the whole thread but I think Ryan's delayed output with all those concatenating stuff is not for everyone, normally I do not use it either. I have a hybrid approach of using all sorts of possibilities which is rather long to explain but maybe one day I have the time to do a write up on it in my own blog. The most important thing is that most of the time I use <?php include __DIR__ . '/../path/to/file.php'; ?> but there is something to keep in mind: http://yagudaev.com/posts/resolving-php-relative-path-problem/ Using PHP's own include() and its variants has the advantage of being able to access all the variables you need during the rendering process without doing much extra "work". It works well for not too "convoluted" frontends. Yet, more sophisticated approaches might be required in other cases but for just starting with ProcessWire you will probably not need more than this for quite a while. Note that PHP is a native template engine, at least Rasmus Lerdorf says so: http://www.tinybutstrong.com/article_3rd_kind.html https://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html I do something similar. Early in the rendering process I implement the "business logic" and store stuff in variables which can be outputted and/or tested later in the native Rasmus's style code part generating the actual output. This way most code editors can auto format, syntax highlight, intellisense, etc... your HTML code. Concatenated code is hard to read to say the least. Some IDEs deal with it well – e.g. PHPStorm (which is not free) – but still...
-
All three modules for ProcessWire capable of sending via SMTP are just piggy-back on WireMail (we have WireMailPHPMailer too) meaning we need to install and configure them but otherwise the code to send the actual email via WireMail is the same, but the module takes over to do the actual sending. The approach itself should not matter in this regard. I only use WireMailSmtp but probably the other two modules can also specify things like default Sender address and name, extra signatures, headers, valid recipients, etc... Also, by sending via SMTP the email is less likely to land in a spam folder, and in some server environments it is not even possible to send via the default mail() function. Google offers 200 (as far as I can remember) SMTP messages a day, however the webserver itself should be able to send it via SMTP too. Google can be used if the local environment does not send it for some reason.
-
First of all, I copy/pasted your code and did not notice that you used submit instead of send. It is send. I corrected my post above. I've been using MAMP Pro for a while – MAMP should work the same in this regard – and I can send emails even with PHP's built in mail() function, not just with SMTP. Meaning in my system both work. SMTP should work from your own local machine no matter what (provided it is configured properly, of course). I use WireMailSmtp but Swift Mailer should work too. Note that you can make sure the sending bit of the code works by using @adrian's Tracy Debugger. The Mail Interceptor Panel should be turned on temporarily only (Once or Sticky button), and by pasting the snippet into its Console and running it, it should show the message: $mail = wireMail(); $mail->to('your@mail.com')->from('your@mail.com')->subject('test 1')->body('body 1')->send(); So first of all, make sure you can send emails. If Tracy can catch your mail, it means your code is ok, so you can move forward and set SMPT up if needed. If you get stuck with setting up the SMTP module, you can post questions in the appropriate forum threads.
-
This one and not just brand new pages. I think it does not really matter what the previous life of the page was if we went to keep it Unpublished. I vote for "save only behavior" so that users new to AOS do not trip over it accidentally just like I do I'm not new to AOS but last time I did not notice that I published the page and it was so for more than a week... Those who are confident enough could switch to the current behavior but that does not include me anymore.
-
@tpr Morning! I have a question about Save on crtl+s (which is command+s on macOS, BTW): from this morning on I need keep it off as I kept accidentally publishing new pages which should not be published yet, it is because the action is not Save but rather Publish and I got used to it forgetting not to do it when I should not publish the page. So the question is: is it possible take into account the status of the page and do "Save + Keep Unpublished" when it is Unpublished?
-
Oh yes it is! As I use the admin's login form as a public login form (just redirecting frontend users to another page) it was crucial to change the logo... #logo { display: none; margin-top: 6px; } //replacing the logo: var logo_o = $("#branding #logo"); logo_o.attr("href", "/"); var innerHtml_str = logo_o.html(); var updated_str = innerHtml_str.replace("/wire/modules/AdminTheme/AdminThemeReno/styles/images/", "/site/templates/admin/"); logo_o.html(updated_str); logo_o.show(); //made hidden by display: none; so we need to turn it on. This is to prevent flashing. I hope that's all. I did it some time ago....
-
In order to change it I used brute force too. Nice to see some in AOS as well
-
This should send the email: <?php $email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL); if (isset($_POST['submit'])) { $to = 'myemail@xyz.com'; $subject = 'Feedback from my site'; $message = 'Name: ' . $_POST['name'] . "\r\n\r\n"; $message .='Email: ' . $_POST['email'] . "\r\n\r\n"; $message .='Comments: ' .$_POST['comments']; $mail = wireMail(); $mail->to($to)->from('myemail@xyz.com'); // all calls can be chained $mail->subject($subject); $mail->body($message); $mail->send(); }
-
The home page has page ID 1, so if($page->id > 1) { echo $page->title .' - '; } means that the page's Title is only prepended to it if it is not the home page. But you remove it altogether so echo $page->title; must spit out the value of the Title field no matter what. In the screenshot I can see that it is a ProcessWire 2.7.3 site. I started with ProcessWire 3.x beta so I'm jut guessing here but probably this feature has been added later. Similar behavior can be achieved with a hook like this: https://github.com/processwire/processwire-requests/issues/124#issuecomment-337139081 and in your case it should look like this: <?php $wire->addHookAfter('InputfieldTextarea::render', function(HookEvent $event) { $inputfield = $event->object; $out = $event->return; if($inputfield->hasField != 'altTitle') return; if(strlen($inputfield->value) > 70) { $alert_text = "The length of this field is greater than 70 characters!"; $event->return = "<p style='color: red;'>$alert_text</p>" . $out; } }); this hook goes into /site/ready.php (if you do not have one just create this PHP file) and it is just a warning, not a validator. Also, the message only appears after saving the page.
-
PHP's mail() is "just" a simple function one can call. However, WireMail is a class, which means one can use it to instantiate objects (ie. "create instances of it") which can be used to "manage" the action of sending emails. You can read a bit about OOP here, for example. First of all $m = wireMail(); gets an instance of WireMail and stores a reference to it in $m. $m is just a variable, it can be called "anything" (except for reserved words, of course) like $mail but do not confuse the function mail() with the variable $m. Just copy the complete examples provided in the docs or in Ryan's post and adjust it accordingly. For example: $mail = wireMail(); $mail->to('user@hi.com')->from('ryan@runs.pw'); // all calls can be chained $mail->subject('Mail Subject'); $mail->body('Mail Body'); $mail->bodyHTML('<html><body><h1>Mail Body</h1></body></html>'); $mail->send(); That is a simple example which should work.
-
You need to use that object – $mail – after you have created it. Like this: https://processwire.com/talk/topic/5693-new-module-type-wiremail/ This topic might get you started: https://processwire.com/talk/topic/8753-simple-wiremail-implementation-on-localhost/ But the easiest/fastest way to setup a contact/enquiry/feedback form is using Simple Contact Form module from @justb3a
-
Hi Bernhard, Modified and Created are the same for new – not yet modified "again" – pages. Does that help? Related post:
-
Hi, Can you give us an example? I cannot seem to follow... Also, your post seems to be cut off at:
-
Go to: Setup > Fields > altTitle > Input tab: Did you get an error (if yes, what?) or you just did not see any change in the source code of the page? If the latter, did you make sure you are not watching some sort of cache? (browser, cloudflare, ProCache, ProcessWire cache etc...) I have no experience with this one but if you are still getting cached pages then it is what makes it hard for you to work on any changes. Seeing how much trouble it means to make changes to the site, you might want to ask for some paid help. Have you considered this?
-
Hi, One solution: for creating Dates setup a PageTable on your single Dates Page, so that Dates are created by adding items in the table. Actual Date Pages are stored under a Parent according to your setup ("Select a parent from items" on the Details tab of PageTable field). From then on, you have a parent which can be used for asmSelects. This can be used for your Settings page. For the Event page, you need to setup "Custom PHP code" for "Selectable pages" under the Input tab of the PageReference inputfield. I've never done this so I'm not the right one to show you a proper example, but this might help you get started:
-
Hi, I do not know if this is what you need, but @bernhard used to share with us his modules: https://processwire.com/talk/topic/15524-preview-rockdatatables/ (see more: https://processwire.com/talk/topic/17207-custom-office-management-crmcontrolling-software/) Also: https://processwire.com/talk/topic/4147-excel-like-crud-in-pw-using-handsontable/ https://github.com/wanze/PwHandsontable https://processwire.com/talk/topic/16608-fieldtypehandsontable-excel-like-inputfield/ Hope this helps.
-
Why not just link to choosealicense.com? Takes up less space (personally I always try not to use too much whitespace in the case of administrative GUIs). Also, they keep their database up-to date so no need to keep in sync should anything change (probably not, but one never knows...).
-
+1 ISC. You might want to link to relevant choosealicense.com pages. Also, you could point out – in the UI – that ISC and MIT are "functionally equivalent". Let's be progressive
-
Module Visual Page Selector (commercial page picker module for ProcessWire)
szabesz replied to kongondo's topic in Modules/Plugins
Option please -
Tutorials are not just a bunch of examples I expect a – good – tutorial to be more than what is written in the docs, some extra info on how to wire things together, and possible gotchas to look after and how to iron them out. Sure, the UIkit docs are good but there is no guidance on where to put those components in a real site, for example. Also, what I'm really missing is the explanation of the design approach of the SASS/LESS structure (eg. how changing a variable will propagate through the components, etc..). They assume one already knows all this stuff. That is where a tutorial could come in handy BTW, I have not yet found any tutorials but I already published a site based on UIkit 3. Still, I am also interested reading/watching them if they exist.
-
This one? https://processwire.com/talk/topic/17477-dummy-text-generators/?do=findComment&comment=153638
-
+1 And do not forget .htaccess as well
-
Great news! Now I just have to find the time to try it out... BTW, how about renaming it to something like Sites Manager? Is it too late to rename it to something more descriptive and less confusing? There is another group of modules with almost the same name: https://modules.processwire.com/modules/multisite/ https://github.com/somatonic/Multisite/tree/dev2#add-multisitedomains also: https://processwire.com/api/modules/multi-site-support/ Multiple solutions with multiple multies in their names are a bit confusing
-
Settings Train (module preview)... all aboard!
szabesz replied to Macrura's topic in Module/Plugin Development
There is one big advantage of "non-standard" names like "Settings Train" – or ProcessWire for that matter – and it is that it's easy to search for them. "SettingsTrain" is already number one result in Google. -
@Marudor Hi, I recommend reading a few tutos, like: https://webdesign.tutsplus.com/tutorials/how-to-develop-a-processwire-theme--cms-25692 http://processwire.com/docs/tutorials/how-to-structure-your-template-files/ http://processwire.com/docs/tutorials/default-site-profile/ It should work but it will not affect the frontend of the site because in ProcessWire nothing is outputted without writing some code in the template files. There is no "theme" in the WordPress sense. You need to start taking a look at the template file(s) rendering the page(s) to get started. The developer who implemented the forntend could have chosen all sorts of ways to do it, but if you can provide some code samples we can help by pointing you in the right direction. As you can also see in the tutorials linked above, you need to look for something like (but not the same...): <title><?php echo $page->title; ?></title> And there must be some concatenation used too which adds "Agencja PR Q&A Communications – Poznań, Gdańsk, Warszawa, Bristol" to the string. You can do it this way: <title><?php echo $page->my_field_goes_here; ?></title> where my_field_goes_here is the name of the field you need to add to the template(s) of the page(s). That is where Markup SEO can help you but I never used that module. However, the site might use a template engine like Twig or something similar, so you might not see regular PHP echos being used and that is why you need to find out what renders what in the fist place.