Jump to content

louisstephens

Members
  • Posts

    516
  • Joined

  • Last visited

Everything posted by louisstephens

  1. Could you possibly give us a little bit more information on how your templates are set up etc?
  2. Ok, so I have the following phpMailer script that works perfectly. However, I also need this to send a completely different email to the person who filled out the form with basic instructions. I am very new to phpmailer (much quicker and easier to work with). Just to lay it all out what I am trying to accomplish: On submit, the php submits the form data to myself via email, but at the same time it sends another email to the user who completed the form with instructions. Has anyone accomplished anything like this before? <?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; } else { echo 'Message has been sent.'; } ?>
  3. I would actually like to know how you went about it using PHRETS. I am not working on anything with MLS values, but I am always looking to expand my knowledge.
  4. Hey Ivan, I have used goto-definition for a few days now and I do like it a lot. I would really enjoy a processwire specific snippet/autocomplete package for atom. I have autocomplete for almost everything else (html, tables, bootstrap, etc etc), but processwire is something I would thoroughly enjoy.
  5. Currently, I don't believe there are any free or paid modules for MLS handling (though please correct me if I am wrong). What format is the MLS feed currently in? You could possibly read the feed (in XML) and then use processwire's API to create the listings using a foreach loop. Possibly set up a chron job (a module for that here) to loop through the feed.
  6. Thanks again Kongondo! I appreciate all the help. I actually figured it out about 5 mins ago (forgot to check back on the forums). It feel good to have actually learned through your help and the various comments what actually is occurring and not blindly copying. Your module has made things so much easier (once I learned).
  7. Thanks again.. Finally starting to understand what is going on, but now it is time to figure out how to give the "second nested ul" a different class than the wrapper ul. I thought I could pass that through with $options, but that doesnt seem to work. (sorry to drag this thread out).
  8. Thank you so much (and sorry for my confusion). I thought I had it, but now I am just getting 6 errors: Error: Exception: Method MarkupMenuBuilder::getMenuItems does not exist or is not callable in this context (in Desktop/_Staging/test/wire/core/Wire.php line 409) #0 [internal function]: ProcessWire\Wire->___callUnknown('getMenuItems', Array) #1 Desktop/_Staging/test/wire/core/Wire.php(347): call_user_func_array(Array, Array) #2 Desktop/_Staging/test/wire/core/WireHooks.php(555): ProcessWire\Wire->_callMethod('___callUnknown', Array) #3 Desktop/_Staging/test/wire/core/Wire.php(370): ProcessWire\WireHooks->runHooks(Object(MarkupMenuBuilder), 'callUnknown', Array) #4 Desktop/_Staging/test/wire/core/Wire.php(371): ProcessWire\Wire->__call('callUnknown', Array) #5 Desktop/_Staging/test/site/templates/navTwo.inc(11): ProcessWire\Wire->__call('getMenuItems', Array) #6 /Desktop/_Staging/test/site/templates/head.inc(85): include('/Us I am a bit lost on this now, though I am trying to dig through them and understand what they mean. What I have thus far (all using example 1b): head.inc <div class="collapse navbar-collapse container" id="bs-example-navbar-collapse-1"> <?php //include('./navigation.inc');?> <?php include('./navTwo.inc');?> <?php echo buildMenuFromArray(0, $menuItems2); ?> </div><!-- /.navbar-collapse --> navTwo.inc <?php $mb = $modules->get('MarkupMenuBuilder');// get Menu Builder $jsonStr = $pages->get(1033)->menu_items; $arrayFromJSON = json_decode($jsonStr, true); #$menu = $arrayFromJSON;// pass an array $menu = 'main';// pass a title /** grab menu items as WireArray with Menu objects **/ // for examples 1a, 2 and 3 $menuItems = $mb->getMenuItems($menu, 2, $options);// called with options and 2nd argument = 2 {return Menu (WireArray object)} #$menuItems = $mb->getMenuItems($menu);// called without options; 2nd argument defaults to 2 /** grab menu items as Normal Array with Menu items **/ // only for example 1b below $menuItems2 = $mb->getMenuItems($menu, 1);// called without options; 2nd argument is 1 so return array /** * Builds a nested list (menu items) of a single menu from an Array of menu items. * * A recursive function to display nested list of menu items. * * @access private * @param Int $parent ID of menu item. * @param Array $menu Array of menu items to display. * @param Int $first Helper variable to designate first menu item. * @return string $out. * */ function buildMenuFromArray($parent = 0, $menu, $first = 0) { $out = ''; $has_child = false; foreach ($menu as $id => $m) { $parentID = isset($m['parent_id']) ? $m['parent_id'] : 0; $newtab = isset($m['newtab']) && $m['newtab'] ? " target='_blank'" : ''; // if this menu item is a parent; create the sub-items/child-menu-items if ($parentID == $parent) {// if this menu item is a parent; create the inner-items/child-menu-items // if this is the first child if ($has_child === false) { $has_child = true;// This is a parent if ($first == 0){ $out .= "<ul class='main-menu cf'>\n"; $first = 1; } else $out .= "\n<ul class='sub-menu'>\n"; } $class = isset($m['is_current']) && $m['is_current'] ? ' class="current"' : ''; // a menu item $out .= '<li' . $class . '><a href="' . $m['url'] . '"' . $newtab . '>' . $m['title']; // if menu item has children if (isset($m['is_parent']) && $m['is_parent']) { $out .= '<span class="drop-icon">▼</span>' . '<label title="Toggle Drop-down" class="drop-icon" for="' . wire('sanitizer')->pageName($m['title']) . '" onclick>▼</label>' . '</a>' . '<input type="checkbox" id="' . wire('sanitizer')->pageName($m['title']) . '">'; } else $out .= '</a>'; // call function again to generate nested list for sub-menu items belonging to this menu item. $out .= buildMenuFromArray($id, $menu, $first); $out .= "</li>\n"; }// end if parent }// end foreach if ($has_child === true) $out .= "</ul>\n"; return $out; } ?> Did I miss something crucial here?
  9. Ha ha.. touche.. Well, I will get this all sorted out. I went with Example "1b", however, I am getting "Call to undefined function buildMenuFromObject()"... Any idea what could cause this?
  10. Thanks Kongondo.. How in the world did I miss that ( I went through like 8 pages)
  11. Ok, this might just be a dumb question...But, has anyone had any success adding "<span class="caret"></span>" into a menu yet using bootstrap? My dropdown works great, save for the the fact that for the life of me I can not figure out how to get the dropdown li to have a caret.
  12. Well, that was a huge case of overcomplicating things by me.. It now works using: echo "<div class='container inner-{$page->switchColor->title}'>";
  13. I thought I had it figured out, but what I coded doesnt seem to be working at all. First let me set up what I am trying to do. Each page of the site has a different background color, so I was going to use a switch statement to just change the div class in conjunction with the Select Options Fieldtype, The switch: $switchColor = $page->switchColor; switch ($switchColor) { case "brown": echo "<div class='container inner-brown'>"; break; case "blue": echo "<div class='container inner-blue'>"; break; case "red": echo "<div class='container inner-red'>"; break; default: echo "<div class='container inner-green'>"; } I also set up a Select Options field type to be used on those pages, which is set to allow only 1 selection. However, it seems that it is failing somewhere and is defaulting to the "green". Did I not "select" the selection the correct way?
  14. To be honest, I never came across that particular thread in all of my searching, but I will definitely comment about the issue. I am currently using 3.0.15 in my staging and production environments.
  15. Just wondering, why are you against (or just not going to use) using media queries to handle the sites layout? I feel it would save you all the extra work and would be easier from the start.
  16. I have used Ryan's VIDEO EMBED FOR YOUTUBE/VIMEO numerous times in various projects and I always love it. However, I went to install it on a 3.0.15 fresh install, and it is saying it cant install it due to it already existing. Has anyone else run into this before? For the life of me, I can not find it in the database.
  17. I got it working! Thank you Robin so much for the help. Instead of using: includeFooter!=1 I used !includeFooter=1 and it appears to be working the correct way now. (idea from here)
  18. Yeah, sorry for being a pain Robin. I looked it over last night and I understand what you are doing, but for some reason it still only displaying the "Home" Link. <?php function renderChildrenOf($pa, $output = '', $level = 0) { $output = ''; $level++; foreach ($pa as $child) { $atoggle = ''; $class = ''; if ($child->numChildren && count($child->parents) == 1) { $class .= 'dropdown'; $atoggle .= ' class="dropdown-toggle" data-toggle="dropdown"'; } else if ($child->numChildren && count($child->parents) > 1 ) { $class .= 'dropdown-submenu'; $atoggle .= ' class="dropdown-toggle"'; } else if ($child->numChildren && $child->id != 1) { $class .= 'dropdown-menu'; } // Makes the current page and it's top level parent add an active class $class .= ($child === wire("page") || $child === wire("page")->rootParent) ? " active" : ''; $class = strlen($class) ? " class='" . trim($class) . "'" : ''; if ($child->numChildren && count($child->parents) == 1) { // Add Caret if have children $output .= "<li$class><a href='$child->url'$atoggle>$child->title</a>"; } else if ($child->numChildren && count($child->parents) > 1) { $output .= "<li$class><a tabindex='-1' href='$child->url'$atoggle>$child->title</a>"; } else { $output .= "<li$class><a href='$child->url'$atoggle>$child->title</a>"; } // If this child is itself a parent and not the root page, then render it's children in their own menu too... if ($child->numChildren && $child->id != 1) { $output .= renderChildrenOf($child->children, $output, $level); } $output .= '</li>'; } $outerclass = ($level == 1) ? "nav navbar-nav" : 'dropdown-menu'; return "<ul class='$outerclass'>$output</ul>"; } // bundle up the first level pages and prepend the root home page $homepage = $pages->get(1); $main_nav = $pages->find("parent=1, includeFooter!=1"); $main_nav = $main_nav->prepend($homepage); echo renderChildrenOf($main_nav); ?> Again, I appreciate your help on all of this.
  19. Ah, twas right under my nose the whole time. I appreciate the assistance! Well... I thought it worked.. Now it just displays the homepage (no other links). Ill have to play with this more.
  20. Thank you Robin S! Just a question on this though, I know using "find" uses a pageArray, so wouldnt I need to use a foreach to handle that? As it stands (looking through the original code), I am confusing myself on where to actually include the "includeFooter !=1" . I tried: <?php /* Navigation for ProcessWire using the Bootstrap 2.2.2 markup This menu was written by Soma based on work by NetCarver and a bit thrown in by Joss Navigation Bootstrap 3 update by Damienov, with multi level dropdown support fix */ function renderChildrenOf($pa, $output = '', $level = 0) { $excludePages = $page->includeFooter= 1; $output = ''; $level++; foreach ($pa as $child) { $atoggle = ''; $class = ''; if ($child->numChildren && count($child->parents) == 1) { $class .= 'dropdown'; $atoggle .= ' class="dropdown-toggle" data-toggle="dropdown"'; } else if ($child->numChildren && count($child->parents) > 1 ) { $class .= 'dropdown-submenu'; $atoggle .= ' class="dropdown-toggle"'; } else if ($child->numChildren && $child->id != 1) { $class .= 'dropdown-menu'; } // Makes the current page and it's top level parent add an active class $class .= ($child === wire("page") || $child === wire("page")->rootParent) ? " active" : ''; $class = strlen($class) ? " class='" . trim($class) . "'" : ''; if ($child->numChildren && count($child->parents) == 1 && $excludePages != 1) { // Add Caret if have children $output .= "<li$class><a href='$child->url'$atoggle>$child->title</a>"; } else if ($child->numChildren && count($child->parents) > 1) { $output .= "<li$class><a tabindex='-1' href='$child->url'$atoggle>$child->title</a>"; } else { //controls links for all $output .= "<li$class><a class='bob' href='$child->url'$atoggle>$child->title</a>"; } // If this child is itself a parent and not the root page, then render it's children in their own menu too... if ($child->numChildren && $child->id != 1) { $output .= renderChildrenOf($child->children, $output, $level); } $output .= '</li>'; } $outerclass = ($level == 1) ? "nav navbar-nav" : 'dropdown-menu'; return "<ul class='$outerclass'>$output</ul>"; } // bundle up the first level pages and prepend the root home page // Change $homepage to find in order to exclude pages from top // $homepage = $pages->get(1); $homepage = $pages->get(1); $pa = $homepage->children; $pa = $pa->prepend($homepage); // Set the ball rolling... echo renderChildrenOf($pa);?> but that doesnt seem to exclude any items from the navigation. Sorry if I missed something (Im still learning PHP and how to handle this all.
  21. Thanks Christophe for the reply. I actually did just what you suggested (using a check box) for the bottom nav. Much easier than what I was originally thinking. But to Clarify for the main navigation hurdle: The bootstrap menu is currently pulling in all fields under "Home" in the tree which is nice. However, I need to remove about 8 pages from it )the ones in the footer. As you suggested, I had thought about changing those pages to "hidden" as a quick fix, but I am afraid having the pages greyed out in the admin will confuse the user. The bootstrap code: function renderChildrenOf($pa, $output = '', $level = 0) { $output = ''; $level++; foreach ($pa as $child) { $atoggle = ''; $class = ''; if ($child->numChildren && count($child->parents) == 1) { $class .= 'dropdown'; $atoggle .= ' class="dropdown-toggle" data-toggle="dropdown"'; } else if ($child->numChildren && count($child->parents) > 1 ) { $class .= 'dropdown-submenu'; $atoggle .= ' class="dropdown-toggle"'; } else if ($child->numChildren && $child->id != 1) { $class .= 'dropdown-menu'; } // Makes the current page and it's top level parent add an active class $class .= ($child === wire("page") || $child === wire("page")->rootParent) ? " active" : ''; $class = strlen($class) ? " class='" . trim($class) . "'" : ''; if ($child->numChildren && count($child->parents) == 1) { // Add Caret if have children $output .= "<li$class><a href='$child->url'$atoggle>$child->title</a>"; } else if ($child->numChildren && count($child->parents) > 1) { $output .= "<li$class><a tabindex='-1' href='$child->url'$atoggle>$child->title</a>"; } else { $output .= "<li$class><a href='$child->url'$atoggle>$child->title</a>"; } // If this child is itself a parent and not the root page, then render it's children in their own menu too... if ($child->numChildren && $child->id != 1) { $output .= renderChildrenOf($child->children, $output, $level); } $output .= '</li>'; } $outerclass = ($level == 1) ? "nav navbar-nav" : 'dropdown-menu'; return "<ul class='$outerclass'>$output</ul>"; } // bundle up the first level pages and prepend the root home page $homepage = $pages->get(1); $pa = $homepage->children; $pa = $pa->prepend($homepage); // Set the ball rolling... echo renderChildrenOf($pa);?>
  22. I am using @Damienov's tweaked bootstrap menu for a project, but ran into a snag. I have a few pages that I dont want to display in the header navigation (but will be used in the footer, another hurtle). Does anyone have any advice on how to achieve this?
  23. Just curious, I have everything set up and a new "gallery" set up using the library, but how do you actually utilize it in a template?
  24. That is the ticket.. I keep forgetting about using page ids. Thanks for the help!
  25. Thanks netcarver. I had actually looked at that earlier, but I (unfortunately) dont have access to the proFields at the moment and dont want to confuse the user with having to use "|" to separate the content. I guess I was hoping to use this much like any other template/page by utilizing: <?php echo $page->settings->body; ?> or by something similar.
×
×
  • Create New...