Jump to content

louisstephens

Members
  • Posts

    516
  • Joined

  • Last visited

Everything posted by louisstephens

  1. I have a Select options field in a template, and I was wondering if it is possible to get all the options from the field (in context to the page) and output them with the current selected option selected? So the output would be something like: <select class="statuses"> <option value="one">One</option> <option value="two">Two</option> <option value="three">Three</option> <option value="four" slected>Four</option> </select>
  2. Thanks everyone! I got it sorted!
  3. So I was going to build a todo tracking app for myself to test/broaden my knowledge of processwire, and so far it has been taxing ?. My Site structure is: - Project One - Phase One - Task - Task - Task - Phase Two - Task - Task - Task So far it was pretty easy, I can easily foreach through the Project and get the phases with their tasks. However, it gets a bit muddled when I have more than one project as I was trying to have a dashboard where the content switches out to the selected project as opposed to accessing each project via their own url. How would yall handle this? My next hurdle is each task has a select field (for project status) that I want to update via ajax (for the smooth transitioning). Scenario: You finish a task, change the option from "new" to "completed", and an onclick changes the status drop down background to green (which I have working), but then posts/saves a field on the backend to the new option. I have a page called "Actions" set up with url segments using if ($config->ajax && $input->urlSegment1 == 'change-status') { //save update field on admin } However, I am a little fuzzy on how to actually pass the current page along with the new selected status to actually update the page (task). I guess I am not very far into my endeavor. Any help would be greatly appreciated.
  4. # ----------------------------------------------------------------------------------------------- # 9. If you only want to allow HTTPS, uncomment the RewriteCond and RewriteRule lines below. # ----------------------------------------------------------------------------------------------- RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # If using an AWS load balancer, use these two lines below instead of those above: # RewriteCond %{HTTP:X-Forwarded-Proto} =http # RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  5. To be honest, I dont really see the empty divs in your sreenshot. However, a foreach loop should only output the exact number of items selected, unless you have a open tag/closing tag out of place.
  6. To be honest, after a lot of searching, I can't really find any clean way of doing this that isnt hacky. I know with explode you can do: $name = "John Doe"; $chunks = explode(" ", $name); echo $chunks[1]; However, I dont think you can really apply this to $pages->find() as it returns a PageArray and not a string which you would need for explode. If you have access to it, the Profields module "Textareas" allows you to have one field, but define multiple fields through it: ie first_name and last_name.
  7. Thanks for the suggestion! Ill have to dive further into the module as I have only used it in a very limited fashion.
  8. So this is more or less just a question regarding best practices, and how to actually achieve this. I have an internal tool I built awhile ago that has just gotten very "trashed". The naming conventions are all out of whack due to trying to get something completed, and pages are just everywhere. The fields got really out of hand as well, but I believe I have found a much cleaner field structure with the Repeater Matrix and a few other ProFields. I decided recently to rewrite the template structure and the fields from scratch to keep everything nice and neat, but then it hit me that I would need to move all the previous data over and populate the new fields etc. The current tree looks something like: Group Title - Section A (template "section") - Category One (template "category") - Category Two (template "category") - Section B (template "section") - Category One (template "category") - Category Two (template "category") Etc etc... The structure is pretty good, and I am thinking of keeping it as it serves my purpose. However, I now have about 140 Sections with child pages that I would hopefully like to move to different templates, as well as changing the child templates/mapping data to the new fields. The only fields I need to worry about are a few textareas, text fields, options field, as well as 1 image filed. I guess my real question is, what is the best way to go about this "migration" via the api while keeping the parent/child structure. It would be ok to leave it as is and chip away at it if I were the only one using it, but unfortunately that is not the case. I guess one approach would be to copy over the entire structure and make the move to the new templates/fields. Once we have verified all the data/templates are correct, we could remove the old structure and possibly rename the new to mirror the old. However, this might just be too complicated.
  9. I believe you could achieve this by "Extra Allowed Content" under the input tab for the field itself. I have mine set up with : img[*] In your source code (after you have uploaded and image to the ckeditor field), you could then simply add in class="img-fluid" and it would then retain the class. Then in you actual code for the template, just use: <?= $page->your_field_here; ?> and the content/image will be output with the correct classes to make it responsive.
  10. Unfortunately, there is not enough information here to fully answer your question. It might be useful if you could provide a bit more information to your setup. Are you using any type of module like wiresmtp, or a 3rd party php library to handle emails?
  11. I havent tested this, but I did find this: https://stackoverflow.com/questions/14039638/apply-background-color-in-ckeditor-textarea
  12. I have done something similar before using: $pages->addHookAfter('saved', function($event) { $page = $event->arguments[0]; // if page template = specific template, then execute desired code if($page->template->name == 'mytemplatename') { # do something here } } I just put it in the ready.php file under the "site" folder.
  13. Just a heads up, I did try to install the theme, but it really did a number on the admin side. Ill have to revert back to a previous state with adminthemeui installed.
  14. Oh I agree completely! In fact, I did exactly as you suggested. Where it got confusing for the enduser was a bunch of nested matrix, and if a "mistake" was made further down the line with their selection, they would have to delete a large selection and restart. However, I do need to come up with a solution that might make things a bit easier.
  15. After reading your question a bit more carefully, I would give a +1 to Repeater Matrix (pro module). You could code the partials (jumbotron, testimonials, etc etc) and then allow users to add in your predefined options.. The only real "hard part" is figuring out rows/columns. I attempted earlier this year to nest multiple Matrix fields for rows, columns, and options but got really confusing for the end user. This has been the only caveat I have found.
  16. +1 for Duplicator. It has saved me so much time deploying projects.
  17. Thanks Macrura for the help. To be honest, I am still wrapping my head around ajax, so I completely overlooked logging the POST requests etc. As it turns out, I had a "wonderful" typo in my code, and forgot the "()" on $page->save() that was causing the issue.
  18. So I have a project where multiple pages are sending POST data to 1 single template page. All was working well (well, at least with one ajax post), but now I have hit a stumbling block. I figured the "best" way to handle the request were to use url segments and then use the following in the status page: if ($config->ajax && $input->urlSegment1 == 'add-bookmark') { // some code here } However, this doesnt seem to really work (as I assume the the request isnt being posted to /status/ but rather to /status/add-bookmark/). What is the best way to actually handle this?
  19. Just did a bit of digging and someone with a similar issue found that apache was down. They resolved the issue by restarting Apache and everything worked well for them after that. (https://www.digitalocean.com/community/questions/502-gateway-errors-who-can-help) service apache-sp start
  20. Not to sure how the rest of your template is set up, but I have found that the following does work. $page->getField('body')->label; Are you using the label in the template corresponding to the actual page, or are you pulling in the label in another template?
  21. Thanks @Ivan Gretsky and @lokomotivan! I meant to respond yesterday, but I got caught up in the code. I actually did go the data-id="" route which I believe will make things much easier to work with in the future. Now I just need to figure out the ajax get side (updating a div once the initial posting of ids is made) and Ill be in business. I appreciate all the help!
  22. Currently, I have a page set up listing all child pages using a foreach loop and outputting some information (thus far, it is all gravy). However, I ran into a slight problem. I have a "button" on each item being rendered that when clicked needs to send the page id to another page for processing via ajax. I thought I could just save the item id like : <?php $itemId = $item->id; ?> And then encoding it below in my javascript: var itemId = <?php echo json_encode($itemId); ?>; var data = { itemId: itemId, }; $.ajax({ type: "POST", url: "/intra/status/", data: data, success: function(){ console.log(itemId); } }); However, it is only posting the last page's id rendered by the foreach. Have I just overlooked something simple on this?
  23. At first, I had a "Oh sh!t" moment when I first read about it. However. after reading a bit more, Im not too worried regarding the acquisition. I am curious if they will push for Azure integration over other cloud services, effectively sweeping the others under the rug.
  24. So, I really don't know where to begin with this. I have the thought in my head (the basics), but not really sure how to set it up. The desired effect: The homepage is set up with a foreach loop that outputs all the child pages (basically just a bunch of pages with pdfs, docs etc stored in a file field). When A user is actually logged in, they can "star" an item or drag and drop (using Dragula) the page to a sidebar. Also, they would be able to reorder the pages in the sidebar. The question(s): I guess I have multiple questions regarding how to achieve this. Would it be best to create a page field in the user template to save the page(s)? How would you actually save the page state (sidebar output, reordering, etc) once the drag and drop has been used? Thanks in advance for any help! A lot of this was just what was in my head, so it might not make full sense. However, I will update this if I can actually wrap my head around everything.
  25. Hey goldman, I believe you could add a class (for when using the Persian language) like .persian (or whatever is better for you). In your css, add the following: .persian { direction: rtl; }
×
×
  • Create New...