Jump to content

louisstephens

Members
  • Posts

    516
  • Joined

  • Last visited

Everything posted by louisstephens

  1. @kongondo, thanks for your help! However, this has caused a new issue. In my headers, I had a few stylesheets that I was linking via <?php echo $config->urls->templates?>/main.css ?> It now appears that processwire "cant" access the urls to the stylesheets anymore, and are just coming up as:
  2. I just started trying to clean up an old site, and possible utilize some things I have learned over the past year (especially since my knowledge of php has gotten much better). I was trying to utilize a function to switch out the included header based on the url, but I can't seem to get it right. I started off with: // Include New Header function headerSwap(){ $homepage = $config->httpHost; $header_one = "/page-link-one/"; $header_two = "/page-link-two/"; switch($homepage){ case "/page-link-one/"; include('headerone.inc'); break; case "/page-link-two/"; include('headertwo.inc'); break; default: include('default.inc'); } } However, it seems that it is always using the default case. I tried echoing $homepage, but that doesnt seem to be returning anything. Any help on this would be amazing.
  3. Hey @LimeWub, I found a soultion to your question. If you go to the template being used by slideshow and navigate to the "Access" tab, you can achieve what you are after. In my case (for the test), I simply unchecked view pages for guest, and selected "Redirect to another URL" which allowed me to keep the page from being accessed by someone not already logged in with the proper credentials.
  4. Ah sorry, elabx, I didnt quite update the code in the post: if(isset( $_POST['submit'])) { $code = Trim(stripslashes($_POST['code'])); $p = new Page(); $p->setOutputFormatting(false); $p->template = 'singular'; // example template $p->parent = wire('pages')->get('/'); // example parent $p->name = $code; // example name $p->title = "Test Title"; $p->save(); echo "page ID {$p->id} created!<br>"; } else { // output contact form echo "Negative Ghost Rider"; } ?> However, how would someone upload a pdf via a field? I tried this already, but and the file looks like it has been sent through to the field, but it is showing up as "0kb"
  5. Hey AndyZyk, it appears to be an issue with form. Ill try to get down to the issue with it and post back in a while. Annnd, I got it.. A simple if(isset( $_POST['submit'])) fixed everything. I should have thought of that sooner.
  6. Good catch fbg13! I guess I missed that when I was pasting my code over and editing it. However, that didn't quite fix the issue. Does anyone know if I missed an important step in creating pages via the API?
  7. As the title states, I am trying to process a form and save the form's data as a new page. I have looked at Soma's post, but it seems (as least to me), that it tackles submission forms etc. I know what I am trying to do is very very similar. The Form: <form role="form" method="post" action="./" > <div class="form-group"> <label for="code">Enter 4-Digit Code:</label> <input type="code" class="form-control" id="code"> </div> <button type="submit" name="submit" class="btn btn-default">Submit</button> </form> And the processing: if($input->post->submit) { $code = Trim(stripslashes($_POST['code'])); $p = new Page(); $p->setOutputFormatting(false); $p->template = 'singular'; // example template $p->parent = wire('pages')->get('/'); // example parent $p->name = $code; // example name $p->title = "Test Title"; $p->save(); echo "page ID {$p->id} created!<br>"; } else { // output contact form echo "Negative Ghost Rider"; } ?> I have been scratching my head as to why this doesn't seem to work for about an hour. I am sure I must be missing something, or trying to go about this the wrong way. The form seems like it submits, but there is no page added to the backend.
  8. Off hand, I would say use something like mpdf and use the customer's logo (either by a simple form upload or via a page in the backend) to export to the pdf. I have done something similar in the past using the last method I suggested. Is this something that they will download to give out, or is it also hosted on the site with just a link the customers give out etc?
  9. Welcome to the forums kasu64, and I hope you enjoy processwire. Just by looking at the screenshot, it looks like you misspelled "modules". http://modules.processwire.com/
  10. I love the new Foundation for Emails. If you are using the sass version, it is super easy to set up and start coding. You really don't even have to mess with tables etc as the stack takes care of parsing all of that when you "foundation build". I did a test the other day in litmus with multiple columns etc and I had no issues across the board.
  11. I will say, MAMP is super easy to use and I use it with everything I do for local. Setting up processwire is a breeze.
  12. I personally use the responsive embed built into bootstrap (would need the source of the map for the "..."). It works just fine for what I need. <!-- 16:9 aspect ratio --> <div class="embed-responsive embed-responsive-16by9"> <iframe class="embed-responsive-item" src="..."></iframe> </div> <!-- 4:3 aspect ratio --> <div class="embed-responsive embed-responsive-4by3"> <iframe class="embed-responsive-item" src="..."></iframe> </div> However, this keeps the aspect ratio and does not just change the width. I know I have encountered this before and I came up with a solution. If I can find it I will post it up.
  13. I actually have something set up for a user who can only add/edit pages. The Setup, modules, and access aren't visible at all to the user. I simply created a new role with with certain actions (page-edit/page-clone/page-edit recent/page-template/page-view/page-lister) and assigned that role to a new user I created. This should "hide" the setup/modules/permission.. Of course @LostKobrakai posted right when I hit submit..
  14. There we go...just another instance of me forgetting the simplest of items and trying to make things too complicated. I appreciate it tpr.
  15. Ill try to explain this as best I can. I am making a site map and using the following: foreach($page->sitemap as $site) { $out = "\n<url>"; $out .= "\n\t<loc>" . $site->httpUrl . "</loc>"; $out .= "\n\t<lastmod>" . date("Y-m-d", $page->modified) . "</lastmod>"; $out .= "\n</url>"; echo $out; } This works perfectly and the url displays as http://sitename.com/data/datasetone/page-one . I was wondering for the sake of this question, is there a way to only pull from /page-one in the url? I know $site->url would give me data/datasetone/page-one, but I really need just the page name
  16. Thanks Robin. I guess I had it in my brain, but could not describe it correctly when I was writing this down. I was merely curious (as I did upgrade from 2.5 to 2.8) and it appears that pages let me select various repeaters to be used as a "template" (ie repeateritemone-1 repeateritemone-2).
  17. Someone correct me if I am wrong, but if I am reading the error correctly, it appears like the field is not attached to the current template (or not created at all). You would need to create the visit_counter field and add to your template.
  18. So I know when you create a repeater you have the chance to select how many fields will be created before you have to save, but I unfortunately created several (10 repeaters) that have started to create a mess. Is there a way to go back to the repeater and edit it to show only 1 so it will stop creating templates? I went back to edit but I did not see this option anywhere.
  19. After getting a lot more confident with my php skills, I thought I would try condensing my file structure by using the _func.php in my templates. I thought this would be a great way to cut down on my includes (Currently at around 12). However, I ran into a bit of a snag. From my reading, I understand that $page is not a global variable, and that I could use something like: $pages = wire('pages'); to get the desired result. However, I must not be using this right :). Here Is what I have: function basicPage(){ $pages = wire('pages'); $output = ""; $output .="<div class=\"container\">"; $output .="<div class=\"row\">"; $output .="<div class=\"col-md-12\">"; $output .="<h1><?php echo $page->title; ?></h1>"; $output .="</div>"; $output .="</div>"; $output .="<div class=\"row\" id=\"tinyInfo\">"; $output .="<div class=\"col-md-12\">"; $output .="<ul class=\"about\">"; $output .="<li>{$pages->about}</li>"; $output .="</ul>"; $output .="</div>"; $output .="</div>"; $output .="<div class=\"row\">"; $output .="<div class=\"col-md-12\" id=\"maincopy\">"; $output .="{$pages->maincopy}"; $output .="</div>"; $output .="</div>"; $output .="<div class=\"row\">"; $output .="<div class=\"col-md-12\">"; include './includes/slider.php'; $output .="</div>"; $output .="</div>"; echo $output; } This doesn't seem to be outputing anything into my template. Have I missed a crucial step here, or is the "output" method I have chosen not even a great way to set this up? I understand includes wont work this way, but if anyone has suggestions on this I would gladly like to hear them. Sorry for a post with so many questions, but I am just stumped.
  20. Thank you @horst .. Yeah, my approach was quite sloppy. I was so focused on getting it to work that I kinda just threw it all together. I need to just slow it down and think it all through. I appreciate the help!
  21. I wasnt quite sure where to post this (perhaps the AIOM thread is the correct place, if so I am sorry).. But I have a switch statement set up on certain values in an options. I have that part working like a charm.. However, when I echo: echo "<link rel=\"stylesheet\" href=\"{AIOM::CSS(array('styles/style.css', 'styles/slider.css', 'styles/style2.css', 'styles/style4.css'));}\">"; It just returns a link. It is like it is rendering one linked file and I receive a 404 error. DId I escape the "" the wrong way? switch ($switchColor) { case "Style3": echo "<link rel=\"stylesheet\" href=\"{echo AIOM::CSS(array('styles/style1.css', 'styles/slider.css', 'styles/style2.css', 'styles/style3.css'));}\">"; break; case "Style4": echo "<link rel=\"stylesheet\" href=\"{echo AIOM::CSS(array('styles/style1.css', 'styles/slider.css', 'styles/style2.css', 'styles/style4.css'));}\">"; break; default: echo "<link rel=\"stylesheet\" href=\"{echo AIOM::CSS(array('styles/style1.css', 'styles/slider.css', 'styles/style2.css', 'styles/normal.css'));}\">"; } I should have actually tried assigning it to a variable and then passing that in to the switch before I posted this. I solved it by assigning the AIOM array to a variable. So apparently that isnt working either.
  22. Thanks adrian. I will definitely check out swiftmailer as well. I am not completely sold on PHP Mailer (as I am still learning and getting comfortable with it), but it was the only thing that I could remember at the time that made attachments a breeze.
  23. I appreciate the help everyone. I didn't realize how much I didn't know about phpmailer until I actually sat down to utilize it in a project.
  24. Thanks everyone! I thought I had it figured out, but alas I have encountered an issue (a very odd one at that). I added in another addAddress $mail->AddAddress($field3, "Bob"); However, mailPhp is sending the email to the original recipient, and the new email is also going to the previous recipient: <?php require("class.phpmailer.php"); require_once('class.smtp.php'); $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPAuth = true; $mail->Host = "********.****"; $mail->Port = *****; $mail->IsHTML(true); $mail->Username = "******"; $mail->Password = "**********"; $mail->From = "*******@********.com"; $mail->AddAddress("*****@****.***"); $field1= Trim(stripslashes($_POST['firstName'])); $field2= Trim(stripslashes($_POST['lastName'])); $field3= Trim(stripslashes($_POST['emailAddress'])); $field4= Trim(stripslashes($_POST['phoneNumber'])); // Email body text $mail->Subject = "First PHPMailer Message"; $mail->Body .= "First Name: $field1"; $mail->Body .= "Last Name: $field2"; $mail->Body .= "Email Address: $field3"; $mail->Body .= "Phone Number: $field4"; if(!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo . $mail->SMTPDebug = 2; $mail->AddAddress($field3, "Bob"); $mail->Subject = "Thanks for contacting us"; $mail->Body .= "Thanks for contacting us at our Site."; $mail->Body .= "<html> <head></head> <body> <table width='550' cellpadding='0' cellspacing='0' style='font-size:10px;font-family:Helvetica;'> <tr> <td><p>Lorem Ipsum</p<</td> </tr> </table> </body> </html>"; $mail->send(); echo 'Message has been sent.'; } ?> Do I possibly have something out of place? Just by looking at it, I would assume phpMailer would email the first email to the email address at the top, and the second email would be sent to $field3.
  25. Hey Sekru, Have you checked your server permissions? I have had similar issues using MAMP a month ago. At least in my case, the issue was due to hosting the site folder via MAMP on an internal server (set up on windows). I noticed that the permissions set on the internal server were overriding my linux hosting permissions. Even though I had the server set to 777 in MAMP, the windows server were not actually granting these permissions. I understand that my case might be a really odd one, but it is worth looking into.
×
×
  • Create New...