Jump to content

louisstephens

Members
  • Posts

    516
  • Joined

  • Last visited

Everything posted by louisstephens

  1. @kongondo, the field submissions is currently a Profields: Textarea field. However, after reading into it more, it seems that the field (and all fields created by it) are bundled into one searchable field. I am wondering if this is the cause of the issue.
  2. Not at all! I appreciate all the help with this. It appears that the form just now shows that everything is already existing. $sent = false; if(isset( $_POST['submit'])){ $name = Trim(stripslashes($_POST['firstname'])) . Trim(stripslashes($_POST['lastname'])); $upper_name = Trim(stripslashes($_POST['firstname'])) . " " . Trim(stripslashes($_POST['lastname'])); $post_name = strtolower($name); $todaysdate = date("F j, Y H:i a"); //Rather only get the first page $submitted = $pages->get("parent=/submissions/, (submissions={$post_name}),(submissions={$input->post->email})"); //Checks for page id, if not it's NullPage object if($submitted->id){ $u = new Page(); $u->template = "submissions-entry"; $u->parent = $pages->get("/submissions/entries/"); $u->name = $sanitizer->text($post_name); $u->title = $sanitizer->text($upper_name); $u->submissions->_date = $sanitizer->text($todaysdate); $u->submissions->full_name = $sanitizer->text($upper_name); $u->submissions->email = $sanitizer->text($input->post->email); $u->save(); $u->setOutputFormatting(false); $session->redirect("?alert=form-success"); } else { $session->redirect("?alert=existing-submission"); } } else { //$session->redirect("?alert=form-failure"); }
  3. Well, I thought I had it.. It appears that it isnt redirecting when you a submission already exists. It currently just throws an error Integrity constraint violation: 1062 Duplicate entry @elabx, any idea of a way around this?
  4. Thanks @elabx! I had no idea that I could set it up like that. Some things are so easy, and I just try to over complicate them in my head.
  5. I guess my difficulty is I have never actually done verifying before using the Processwire API. I have always started with: if(isset( $_POST['submit'])){ $u = new Page(); $u->template = "entries"; $u->parent = $pages->get("/entries/"); $u->name = $sanitizer->text($post_name); $u->title = $sanitizer->text($upper_name); $u->save(); $u->setOutputFormatting(false); $session->redirect("?alert=form-success"); } else { $session->redirect("?alert=form-failure"); } However, I was not quite sure how to get the post input, check if pages already had the email or name, and act accordingly.
  6. Hopefully this is pretty easy/quick. I have a signup form with name and email and on submit, a new page is created under "Entries". Is it possible to check if the name (which has two fields for first and last) and or the email is already registered and display an error?
  7. Thanks @dadish! I did as you suggested and still got "Loading...". However, I went through and looked at modules (pretty clean install with not many modules) and disabled TraceyDebugger and now it seems to be working perfectly. I should have done this prior, so my apologies.
  8. First of all, I love the module thus far. Unfortunately (for me), When I go to Setup->GraphQL, it pops up with "Loading...", but never actually loads anything . I am currently using php 5.6.30. Any idea what might be causing this? I dont currently have any errors in my console either.
  9. I will gladly share some insight. 1. The system (processwire) allows a user to create a modal using a template that has various options: text color, image, width, etc etc that will be passed to the js init function for the modal. However, since there will be different modals (All with different settings) the init codes all need to be different. In the long run, these modals are being used elsewhere off-system. The modal has some data attributes that allow the modal to be "iframed", so I can use the js init to target the div with the data attribute and load the desired url as an iframe on the site. I have one running just fine (hard coded), but it occurred to me that since it is acting like it is iframed in, the scripts to make it work need to be outside the page that the user made, and posted off-system to make it work in the desired fashion. 2. The javascript that I am executing are the custom init scripts to fire the modal, which are unique to each one. I had thought of posting all the custom selected options on a page, and use fopen() to create a new unique file and provide a url to that so users could copy the custom script url along with the url to the page, and once posted the modal would fire. However, if there is a more elegant solution, I am all ears. Sorry if it seems confusing, I am still trying to wrap my head around everything as well.
  10. I am sorry about that @Robin S .. I went on vacation and honestly forgot about my previous question. I do appreciate the help. I guess I was trying to figure out a way to "write" the custom js to a file that could be referenced later like <script src="js/custom.js" type="text/javascript"></script> As it stands, I can parse my custom data into the init script and have it out put like: $(".custom-modal").iziModal({ title: '', subtitle: '', headerColor: '', background: null, }); But all of this was going to be wrapped in a cookie script, so to make it "easier" on whomever was posting, I needed to find a way to throw the init script into a file. Perhaps I am just making things way more difficult than they need to be.
  11. So I have a fairly unusual project, and I am still trying to wrap my head around it (so excuse me if this doesnt make much sense). A user will create parent page (in the backend) with a modal (piece of cake), but then have a custom js file for each parent page. I wouldn't have an issue with creating a new file everytime, but this instance calls for it pretty much to be an automated process as the users are not tech savy. I was thinking that I could create the template for the modal (which will be iframed elsewhere), and using an approach found here, automatically create a "js" child page that I could then somehow output to a custom js file. I guess I have several questions regarding this since the modal is iframed in: 1. Since the init script for the modal has to be outside of the iframe (and placed elsewhere), what is the best way to render the custom script (which will be generated from options on the page in the backend. 2. Would it even be safe/secure to even attempt this since the js file would be referenced elsewhere (though still in a file on the pw install)
  12. Ah, I understand. However, I was referring to a screenshot halfway down the page illustrating that the new page could be accessed via a link at the top. With a bit of php, you could redirect a user with a certain role to the "Hello" tab, or "Streams" in your case.
  13. I have found that this article really helped me out on a recent project. It guides you through creating a new module that adds the Name/link to the nav bar at the top.
  14. Thanks @3fingers, I completely had a brain fart in regards to using strtolower() on a $var.
  15. Thanks @elabx, I tried, but in the source I am getting: <p>Demo<span class="{strtolower(1->title)}">Management</span><</p> I have included my foreach loop as well (if it helps) <?php $dash = $pages->get("/dashboard/"); $dashchildren = $dash->children(); $out = ""; foreach($dashchildren as $dashchild){ $out .= "<p>" . "<a href=\"{$dashchild->url}\">" . "{$dashchild->title}" . "</a>"; foreach ($dashchild->children as $dashgrandchild) { $out .= "<span class=\"strtolower({$dashgrandchild->posistion->title})\">" . "{$dashgrandchild->title}" . "</span>"; } $out .= "</p>"; } echo $out; ?>
  16. Does anyone know how to change the title of a select options to lower case? Right now, I have 3 options: "Management, Editor, Guest" (titles are uppercase in the backend), and I would like to change them to lower case in my template as I am adding them as a class name to span tags, ie "<span class="management"></span>". I will note, that I am using $level->title (the options) in a nested foreach loop, if this changes anything. Also, I thought I could use strtolower(), but it is just being "echo'd" in the source code.
  17. So, I am not even sure if this is possible, but I thought I would ask anyway. I was building a "system" that would make some modals (izimodal) using a few fields. A user would select the color combo they want, enter a title, fill out the body, and then I was going to pass this (in the template) to fill in the modal. I have this all working pretty flawlessly. <div id="example-modal" class="model" data-izimodal-autoopen data-izimodal-transitionin="fadeInDown" data-izimodal-iframeURL="<?php echo $page->example->url; ?>"></div> <script type="text/javascript"> $("#ca-entrance-modal").iziModal({ title: 'Custom Title Here', subtitle: '', headerColor: 'Custom Color Here', history: false, iframe : true, fullscreen: false, loop: false, width: 350, iframeHeight: 350, top: null, bottom: null, borderBottom: false, closeButton: true, }); </script> However, I have hit a road block. The modals are using iframes to pull in the corresponding modal page, but the javascript options are not being iframed (so the modal will actually launch etc). My thought was the user can just copy the page link to the modal, and insert it into the iframe and simply adding the js code, the modal would work (which it does). I guess here is my actually problem. Since the user is selecting several options to "customize" the modal, the javascript is custom and differs between each modal. Is there a way to "disable" a textarea, and output the "custom" javascript inside the textarea so they can copy it for inclusion on their actual pages? Or, is this something that I should just output in the frontend view for users.
  18. Just curious, are you using the Profields Page Table module? If so, under input (when editing the field), simply add "template" to the list of "Table fields to display in admin" and it will add a column with the template being used.
  19. This has been my experience with a site I inherited (wordpress) that was using the Oxygen plugin. There are template partials stored under the plugin menu that you "call" from the visual builder (ie once you go to edit a page). It really became a nightmare on finding what parts were being used, and where all of this data was being housed in the backend. Giving the client/user a way to drag/drop content seems nice, especially when you know the project is over. However, when you come back to it for any updates, the project has turned into a tangled mess with no map. I do apologize if this has became a rant on Wordpress, as I still enjoy wordpress for blogs. It really comes down to having a nicely structured backend where it all "just makes since".
  20. You can achieve something (that I think is better) using a the Repeater Matrix (profield). I was actually playing with this the other day. I created several "blocks" ie image/text, quotes, slideshow etc etc and with very little effort (output styling not included) had a homepage built. I like this approach better than Visual Builder as it allows the developer to have a bit more control of the output (styles/layout). In my experience, vb can lead to bloat, and a very fractured site structure. It also, at times, makes it difficult to find where pieces of the site are located.
  21. So I have a project coming up soon and one of the goals was to use Google's AMP project for the project's mobile site. I have gone through the tutorials and think I have a good grasp on the matter, but there is still one roadblock I do not really know how to tackle. The site, which uses a responsive grid system, will look great on a mobile and desktop which was is fine by me. However, if a user comes from Google to one of our AMP pages (ie www.example.com/amp) and clicks on a url, they will then be loading our responsive mobile pages and not the amp pages. For the sake of consistency, we really want to "force" users to stay on all the amp pages. My current thoughts on how to set up this task: Allow url segments for all pages using "/amp" Using a simple if statement, load the amp page if it exists <?php if($input->urlSegment1) { // add "&& $input->urlSegment1 == 'amp'" if you've more urlSegments include("partials/amp-page.php"); } else { include("partials/normal.php"); } ?> However, I have hit a roadblock on appending "/amp" to all pages if they came to an amp page via Google, or even if they are on mobile and visit the site. Is this even possible to do, or should we just use the amp pages (if a user comes from google) and allow them to be active on our mobile pages? We are just trying to give the fastest load times possible, as well as give a consistent look between mobile and desktop versions. As always, I really appreciate the ideas and help.
  22. Thank you Lex Sanchez! I was using 'permission', but foolishly used the role instead of the permission.
  23. So I have a module that builds a dashboard (following the tutorial: https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/#handling-user-input-using-forms-amp-inputfields). It all works great now that I have gotten some kinks worked out. However, the page is saved under admin which is hidden from users that are not superusers. Is there a way to allow the user, with a certain role, to view this newly created page, and only this page?
  24. I have been following @bernhard's great tutorial on creating a Dashboard and everything has very easy to understand so far. However, I need to add a select field that a template is using (so users can create a new page from the dashboard), but I am really at a complete lost on how to achieve this. I have been googling, but can't really find anything on the matter. $field = $this->modules->get('InputfieldSelect'); $field->name = "Select Manufacturer"; $field->findPagesSelector = "template=basic-page"; //not needed for select field $field->labelFieldName = "title"; $field->name = "Manufacturer Select"; $field->columnWidth = 34; $fieldset->add($field); I have the above code, which was originally an InputfieldPage, but since this is an options field, I have changed it. Has anyone actually gotten a select from a template (and its' values) in a module?
  25. PHP is a server-side scripting language, and sends the data to the client on page load. To get the script to run without a page view, you would need to set up a cron job. Cron jobs are used for scheduling tasks/scripts to run on the server. If you are using shared hosting, there is normally a tool in the control panel for setting up and managing cron jobs.
×
×
  • Create New...