Jump to content

Pete

Administrators
  • Posts

    4,043
  • Joined

  • Last visited

  • Days Won

    67

Everything posted by Pete

  1. With ProcessWire you would just use PHP and output data using the API directly in the template files. What you won't find is a tool for dragging and dropping blocks of content though I'm afraid - ProcessWire makes no assumptions about what you're doing with regards to layout, however a few lines of code will usually get you what you want anyway. What you will find is a very useful companion in HannaCode if you want to re-use blocks of code throughout different templates. For example, if you have a page called news and you want to generate a list of the latest 10 headlines you only need to do something like this: <h2>Latest News</h2> <ul> <?php foreach ($pages->get('/news/')->children('sort=-created, limit=10') as $article) { echo "<li><a href='$article->url'>$article->title</a></li>"; } ?> </ul> Now, if you want to re-use that code in different layouts then I would recommend putting snippets of code like that into the HannaCode module - this one could be called latest_news for example - and then in your various templates to output that where you want you would simply put [[latest_news]] where you want that to appear. So assuming that your templates will be delivered to you as HTML files (??) then you can be making these snippets of re-usable code in advance ready to drop into the right place. If that assumption is incorrect and you're going to be presented with a PSD file and have to convert it to HTML yourself then an excellent starting point to achieve the sorts of layouts above is using something like these two HTML/CSS/JS frameworks: Foundation and GetUIKit. Hope that's of some help!
  2. diogo's pretty spot on there - I did this all back before I knew things like simplehtmldom (in his above post) existed. If you get the contents imported and use that to iterate through all the image fields, you can indeed then use the article he links to to have PW pull the image files into PW and replace the output with simplehtmldom as you go. My code was so specific to the site I was working on I don't think it's worth posting but I will try and dig it out tomorrow to see if there are any other useful pointers that arose from the process.
  3. I did this on a smaller scale. I'll see if I can find my code but it won't be til tomorrow unfortunately. It basically just looked for the images in the HTML usng a preg_match_all I think, imported the images to the new page, replaced the image URLs in the HTML and saved the updated HTML. Worked quite well but I was doing it with few enough pages that I was checking them a page at a time. That way was a little less system-specific actually.
  4. Email isn't a bad idea - could just save the data to a JSON array and sent via email as a text file and read it in that way via a script and a cron job if the data is more complex than email to page will handle.
  5. Yup, technically Google Maps can't be used behind logins (so intranets are out) and over a certain number of tile views you're supposed to pay. Openstreetmap gets better every day - I've not used it for driver ng directions or anything like that but I imagine that works okay since there are so many contributors of information to it. I also used the light version of this tileset in a recent project as I needed something minimal to overlay onto: https://cartodb.com/basemaps/ -they're free basemaps and there are lots of others. Google however does let you set colours on the maps so to my mind that's the main advantage they have. For everything else Leaflet JS just seems easier to use to me.
  6. @kixe - should be up to date now, apologies for the delay. @Peter - Bernhard is correct. It does use MapMarker in the backend though to Geocode the "address" (sometimes just a city and country) to a latitude and longitude for use on my map. Leafletjs is pretty awesome - I used it on a much more complicated project recently however I need to do a full write-ups for that and get approval from the client before I can share too much, but it has routes on the map and tens of thousands of coordinates and doesn't take all day to load
  7. There sure is - one of Ryan's commercial modules: https://processwire.com/talk/store/product/11-likes-fieldtype-single/
  8. That's a good point and I remember now that was the reason I didn't try to fix what wasn't an issue
  9. Just thought I'd add that there's an LDAP login module (on mobile so can't find the link right now) that I've been using just fine for authentication with Windows 2008 and 2012 servers from an external Apache server with no issues whatsoever (well unless one can't talk to the other due to network issues but you could sunc your username and password with PWs users every login and just let PW handle the login if it can't see the LDAP server for whatever reason).
  10. In which case, who are they trying to protect it from? Just don't give anyone else FTP access to the server would surely be the answer and your PHP code is safe to all but those internal employees with access? Their competitors can't see the code just by looking at the site after all. In my opinion, obfuscation only adds overhead (as does using something like IonCube or Zend Guard), but if you want to keep the unencrypted code locked away safe and only put encrypted PHP code on the production server then IonCube or Zend Guard are the things to look into.
  11. I can only assume you mean the final rendered HTML? Everything else you can protect by not giving anyone else FTP access so they can't see your PHP code in the template files If you are talking about the rendered output in the browser, obfuscating HTML would be a bad idea, but you can make it relatively hard work for someone to read it by minifying the output (AIOM module has this ability). However there are plenty of other sites out there where you can throw in some minified HTML and have it un-minified. Same with Javascript files too. I think that what they are asking for isn't really possible - anyone can steal the design of any website. Except those built purely in Flash of course
  12. Might be worth explicitly setting max_input_vars to something really high (make it 10000) and not trusting the fact that it's not set according to this: http://stackoverflow.com/questions/10638075/max-input-vars-set-even-if-commented-in-php-ini And yes, fingers crossed this or something like it fixes all your issues in one go
  13. Does your server have mod_security turned on? I only ask because sometimes with mod_sec on a certain number of instances of words like "init" and "*" as well as regular expressions can trip mod_sec rules I believe and that usually results in no visible error but no data saving. If you do have mod_security enabled on your server, you could try turning it off temporarily and saving the data again. I've run into this myself in the past but usually with words like "select" and "drop" so mod_security incorrectly things I'm trying to post SQL queries into an editor and hack the database. It can be a bit dumb like that at times
  14. Hi Fred Just in regards to this comment above - your other thread was posted on a Friday and it's the weekend so I'm sure people will chime in during the week if they can help (the forums are almost always quieter on the weekend). Any replies in the forums are from community members giving up their time to help - there is no guaranteed support, so please be patient if you don't receive any replies for a day or two when posting.
  15. You should use Fieldtypeoptions now which is built into the 2.6 branch - it is a core module that does the same and more
  16. I've not used any of the modules around the forums for this but would recommend trying something like Soma's solution about halfway down in this topic: https://processwire.com/talk/topic/1071-page-fieldtype-two-way-relation/ You'll need to hardcode the two fields you want to "sync" but this also explains the problem actually - you can't just have the same field at the other template automatically as you might want to put it in certain place and label it differently etc (makes sense since its doing the reverse in the other template). I'm not sure there's a more sensible way than Soma's module as otherwise it has to make too many assumptions whereas his is basically a case of creating two page fields to lookup the relevant pages in each template and syncing them with the module when a page using either template is saved. Hope that makes sense?
  17. You have to use return as basically you can do more complex PHP over multiple lines using that option, so you can do a selector to get a certain bit of info to use in another selector for example and really do some interesting stuff there (sorry that might sound vague but examples are eluding me at present - I just know that's how I've used it in the past).
  18. Sweet, thanks Tom, looking forward to it
  19. I'll have to get my Reno colour schemes sorted on Sunday when I'm back off holiday. Tom - can you send me a copy of the theme when you send it to Ryan so I can make sure they're 100% compatible before the updated theme is released - shouldn't take me long.
  20. I was going to say same as Martin - unpublish them in the page tree would be easiest. A quick module could add similar functionality to the normal user profile page for superusers maybe as I don't think you can do it there (can't check quickly as on mobile).
  21. Just to clarify, AJAX in any CMS requires JavaScript. It cannot be done purely on the server side (PHP) as you have to get a request from the client side (your web browser) to tell the server what you want and listen for the response. Any plugins or modules you have seen in other systems must also use JavaScript if they are doing AJAX - indeed the J in AJAX stands for JavaScript.
  22. And here's some code for those that may need it: $myfieldset_start = false; foreach ($page->template->fields as $field) { // or something like $this->templates->get('templatename')->fields if ($field->name == 'myfield') { // opening element of a fieldset is just the field name you gave it $myfieldset_start = true; } elseif ($field->name == 'myfield_END') { // ending element is field name with _END on it - break out of the loop if we reach this break; } elseif ($myfieldset_start == 'true') { // otherwise we are iterating fields in the chosen fieldset so do what you like here echo $field . "<br>"; } }
  23. That would do it diogo - I hadn't thought of the simple answer! I had been looking for some magic function thinking there was some relationship stored between the fieldset and the fields inside it forgetting it's a purely visual thing.
  24. Hi folks I'm trying to fetch and iterate through fields in a specific fieldset in a page via the API but for some reason my brain cells are failing to work as a team tonight. Any suggestions?
  25. @mr-fan - Please feel free to add it there as I need to sleep now, mega-busy tomorrow and will be away for a week from Saturday - glad I could help @tpr - if you're viewing the first item, the link for Next will show to take you to the second item. I think maybe what you mean though is when viewing the first item should there be a "previous" link to the last item for consistency? I may be completely misunderstanding your question of course.
×
×
  • Create New...