Jump to content

diogo

Moderators
  • Posts

    4,296
  • Joined

  • Last visited

  • Days Won

    79

Everything posted by diogo

  1. Ok, spotted! I forgot the quotation marks on javascript. Already corrected on the above code.
  2. It's before, already updated the post...
  3. sorry, I should have mentioned that you have to put it before calling the javascript file: <?php echo "<script><!-- define variables for JS --> var pageName = '{$page->name}', pageTitle = '{$page->title}', pageWhatever = '{$page->whatever}'; </script>"; ?> <script type="text/javascript" src="<?php echo $config->urls->templates?>scripts/main.js"></script> edit: corrected the order and added quotation marks
  4. You can put this on the header of the page: <?php echo "<script><!-- define variables for JS --> var pageName = {$page->name}, pageTitle = {$page->title}, pageWhatever = {$page->whatever}; </script>"; ?> and on your script: $("#bodycopy a:has(img)").addClass('lightbox').attr('rel', pageName);
  5. Before you couldn't, and I would advise you to put the comments field on a tab, and all the others on another tab, so that they would be hidden from the user by default. But now there is this http://processwire.c...ld +permissions Edit: I completely misunderstood your question...
  6. I wouldn't do this with repeaters. In this case would make more sense, and be more flexible, if you create them as children of this page. Then you just have to do: foreach($page->children as $dealer){ echo "<tr><td>{$dealer->title}</td><td>...</td><td>...</td><td>...</td></tr>" }
  7. you could also simply put a redirect on the admin template for this user role.
  8. I'm very interested to see this website finished
  9. that setting must be easily accessible on the template. maybe if you have a look at the module code you will find how. sorry that i can't help more now...
  10. i'm at the mobile, and can't confirm this, but i seem to remember that with the thumbnail module you define the width in the settings of the field. so you can safely know in advance what will be the size of the images generated by it
  11. Same thing happened to me, and the problem was the GD library. I reinstalled it and everything was fine.
  12. hi! you can still hardcode it before the foreach(). i"m on mobile, so i can't help with a code example.
  13. Ryan, you can block us from appearing.
  14. What do you have to say in your defence soma?
  15. I'm surprised why Finland is not the first
  16. For user login you should use the login system. What onjegolders is suggesting is that you create a normal page on the tree for each user that you associate with it. This would allow you to have all the photos and any other info that you want to associate with the users, without having to use the real user pages for this (that would imply changing the "user" template to accommodate the new fields). Downside for this is that your client would have to create a page with the same name as the user everytime one is created. Apparently onjegolders has a solution for this that sounds good: As I said, the alternative would be enhance the "user" template to accommodate all you need for each user. This is actually very simple to do, and I think you should at least try it. To do this go to setup>templates and click the "filters" bar to expand it, and choose yes for "show system templates". Edit the "users" templates and add the fields you need (I would suggest that you create a fiels of type fieldsetTabOpen, and put the new fields on a separate tab). Than your client just have to go to the "users" tab on the admin nav, and add all the info and images for each user there.
  17. Yes, method should be post. Since you will be submitting to the same page, all the code will go on the same template. You might want to do this as the action: <form id="orderForm" action="<?php echo $page->url ?>"> Now we have to test for the submission of the form. This test can be used also inside the form to output errors. I will use the radio button for this, since it will have a value for sure if ($input->post->premium) { // form was submited. Here is where we will collect all the information }else{ // you don't have to use the else, but here is the place to output something for when the form wasn't submited } // form should go outside the if statement To collect the information we will have to know where to send it to. I don't know if you decided on those things but, are you going to create a page for each transaction? Or a page for each client? Here I will assume you will want to save a page for each transaction. For this you will have already prepared, a template "transactions" with all those fields (customer_name, email, quantity, addons, premium), and I will assume that you will have all the transaction as children of the page "/order/". if ($input->post->premium) { // create a new transaction page $tr = new Page(); $tr->template = $templates->get("transaction"); $tr->parent = $pages->get("/order/"); // fill the fields with the collected and sanitized info. See here about sanitation in pw [url="http://processwire.com/api/variables/sanitizer/"]http://processwire.com/api/variables/sanitizer/[/url] $name = $sanitizer->text($input->post->customer_name); $email = $sanitizer->email($input->post->email); $quantity = (int) $input->post->quantity; // (int) makes sure that the input is a number $add_ons = $sanitizer->text($input->post->addons); $premium = $sanitizer->text($input->post->premium); $tr>of(false); // this was wrong on my fist post. must be false $tr->customer_name = $name; $tr->customer_email = $email; $tr->quantity = $quantity; $tr->add_ons = $add_ons; $tr->premium = $premium; //save the page $tr->save(); // send the email to you $subject = "new buy"; $message = "{$name} bought {$quantity}. His email is {$email}"; mail('youremail@example.com', $subject, $message); // here you can redirect to a confirmation page, or to the same page for another buy } // code for the form This was only the basic. You should also perform some validation in the php code, and check if everything is ok before creating the page. The most common way is to use a errors array.
  18. You are thinking well here. Repeaters were created for a small number of repetitions. For a less predictable amount that justifies paginating would be better to use normal pages. In your case, you would have a page "testimonials" as a child of "our customers" and each children of "testimonials" would be one testimonial. The template for those pages would have the fields that you put on the repeater. foreach($pages->find('template=testimonial') as $testimonial) { echo "<blockquote><p>{$testimonial->testimonial_body}</p>"; echo "<small>{$testimonial->testimonial_customer}</small></blockquote> "; echo "<hr>"; } edit: It's also good to add that you are not forced to create a template file for all templates. In the case of the testimonials pages, if you are not planning to display them individualy, just create their template without a corresponding file, and their URLs won't be accessible in the browser.
×
×
  • Create New...