Jump to content

LedZepmann

Members
  • Content Count

    25
  • Joined

  • Last visited

Community Reputation

10 Good

About LedZepmann

  • Rank
    Jr. Member
  • Birthday 10/21/1960

Contact Methods

  • Website URL
    http://www.secondson.com

Profile Information

  • Gender
    Male
  • Location
    Michigan
  • Interests
    Musician (Bassist), Audio Engineering, Web Design.

Recent Profile Visitors

2,004 profile views
  1. I was experiencing this same problem and the second loop did the trick! <?php foreach ($page->slider as $slide) { foreach ($slide->slideimage as $image) { echo "<a href='{$slide->slidelink}'><img class='radius' width='1000' src='{$image->url}' alt='{$image->description}'></a>"; } } ?>
  2. Hi @adrian, I've tried using the throw new Wire404Exception() in several PW projects and it never works for me - I get errors instead, like: Error: Exception: (in C:\wamp\www\yourmrrooter\site\templates\_init.php line 122) #0 C:\wamp\www\yourmrrooter\wire\core\TemplateFile.php(168): require() #1 [internal function]: TemplateFile->___render() #2 C:\wamp\www\yourmrrooter\wire\core\Wire.php(389): call_user_func_array(Array, Array) #3 C:\wamp\www\yourmrrooter\wire\core\Wire.php(344): Wire->runHooks('render', Array) #4 C:\wamp\www\yourmrrooter\wire\modules\PageRender.module(356): Wire->__call('render', Array) #5 C:\wamp\www\yourmrrooter\wire\modules\PageRender.module(356): TemplateFile->render() #6 [internal function]: PageRender->___renderPage(Object(HookEvent)) #7 C:\wamp\www\yourmrrooter\wire\core\Wire.php(389): call_user_func_array(Array, Array) #8 C:\wamp\www\yourmrrooter\wire\core\Wire.php(344): Wire->runHooks('renderPage', Array) #9 C:\wamp\www\yourmrrooter\wire\core\Wire.php(411): Wire->__call('renderPage', Array) #10 C:\wamp\www\yourmrrooter\wire\core\Wire.php(411): PageRender->renderPage(Object(HookEvent)) #11 C:\wamp\www\yourmrrooter\wire\core\Wi Where line 122 is the "throw new Wire404Exception();" command... The session redirect is my work-around for the above error.
  3. First, I commented out the entire block of code, and all this did was allow, for example, /drains-backing-up-total-drain/ to reload the page or allow any page I was currently on to reload. This is because URL Segments are ON for all pages. To double check this, I turned off URL Segments for my home page template and voila, the redirects started working... SO, it would appear that when URL Segments are enabled, this will disable the ProcessRedirects module! Therefore, I'll be setting up redirects on the web server - hopefully that will work but won't know till I deploy the site.
  4. Hold the phone... I have urlSegments enabled and am doing some localization depending on UrlSegment1, therefore changing text and phone numbers in pages - here's the code, which is placed in my _init.php file: $countyPages = $pages->get("/service-locations/counties/")->children(); foreach ($countyPages as $cp) { $validCounties[$cp->title] = $cp->title; } if(isset($validCounties[$input->urlSegment1])) { $localpath = str_replace("","","$input->urlSegment1"); $localphone = $pages->get("/service-locations/counties/$input->urlSegment1/")->countyphone; $localphoneshort = str_replace("-","","$localphone"); $namecounty = $pages->get("/service-locations/counties/$input->urlSegment1/")->countyname; $name = str_replace("-"," ","$input->urlSegment1"); $name = ucwords($name); } else if($input->urlSegment1 == '') { $localpath = ""; $localphone = $pages->get("/settings/")->phone; $localphoneshort = str_replace("-","","$localphone"); $namecounty = $pages->get("/service-locations/counties/")->countyname; } else { $nunya = $pages->get("/http404/"); $session->redirect($nunya->url); } if($input->urlSegment2) { $nunya = $pages->get("/http404/"); $session->redirect($nunya->url); } So, it would appear that a redirect is being treated as a urlSegment1... Any way to get around this? Perhaps I'll just have to set up redirects on the web server.
  5. Hi @Mike Anthony, It would appear to be a PW 404 as this page is displayed when attempting to call a redirect url: yourmrrooter.lo/http404 - see screen shots:
  6. Hi All, I'm moving a site from it's current CMS into Processwire. I've installed the ProcessRedirects module for this project. I'm working locally on Windows 7 using a virtual host (yourmrrooter.lo) with WAMP server. The problem is the redirects simply do not work and instead I get a 404. Example: on the current live site, a page exists at www.yourmrrooter.com/drains-backing-up-total-drain/. In my Processwire site, the page exists at yourmrrooter.lo/residential-plumber/clogged-drains/total-drain/. I've set up a redirect in the module for /drains-backing-up-total-drain/ to point to /residential-plumber/clogged-drains/total-drain/ and I get a 404 page instead. Are there any known issues / fixes? Thanks
  7. Thank you @horst! Here is my final code and it's working perfectly: $countyPages = $pages->get("/service-area/counties/")->children(); foreach ($countyPages as $cp) { $validCounties[$cp->title] = $cp->title; } if(isset($validCounties[$input->urlSegment1])) { $localpath = str_replace("","","$input->urlSegment1"); $localphone = $pages->get("/service-area/counties/$input->urlSegment1/")->countyphone; $localphoneshort = str_replace("-","","$localphone"); $namecounty = $pages->get("/service-area/counties/$input->urlSegment1/")->countyname; } else if($input->urlSegment1 == '') { $localpath = ""; $localphone = $pages->get("/site-common/")->phone; $localphoneshort = str_replace("-","","$localphone"); $namecounty = $pages->get("/service-area/counties/")->countyname; } else { $nunya = $pages->get("/http404/"); $session->redirect($nunya->url); } if($input->urlSegment2) { $nunya = $pages->get("/http404/"); $session->redirect($nunya->url); } Note the session redirects - for some reason, the "throw new Wire404Exception();" is resulting in an internal server error rather than redirecting to the 404 page. So I came up with this work around. Anyone with suggestions for correcting the problem of throw new Wire404Exception(); not working are welcome to comment here Thanks again horst!
  8. Thanks to @Joss, I'm now using URL Segments to populate my page content with local information by county. So for example, neighborhoodsewerdrain.com renders the base site, and neighborhoodsewerdrain.com/macomb/ will pull in the county name, local phone number, etc. Fantastic! I created a template with no template file, and pages for individual counties that use this template. Each page has fields that hold the title, county name, page content, and county phone number. The title matches the URL Segment I want to target. This is the code in my _init.php file that modifies template content and I'm using similar Hanna Code for page content: if($input->urlSegment1) { $localpath = str_replace("","","$input->urlSegment1"); //adds url segment to navigation path $localphone = $pages->get("/service-area/counties/$input->urlSegment1/")->countyphone; $localphoneshort = str_replace("-","","$localphone"); $namecounty = $pages->get("/service-area/counties/$input->urlSegment1/")->countyname; }else{ $localpath = ""; //if no urlSegment1, then add nothing to navigation path $localphone = $pages->get("/site-common/")->phone; $localphoneshort = str_replace("-","","$localphone"); $namecounty = $pages->get("/service-area/counties/")->countyname; } Currently, if someone happened to type in "neighborhoodsewerdrain.com/foobar/," then "Foobar County" appears in the page content and nothing populates in the template - I don't want that! What I would like to do is check to see if the urlSegment1 matches up with a county page, then execute the code above, and if not, then refresh the browser back to the base domain and remove the bogus url segment from the path displayed in the browser URL bar. Another option would be to throw a 404. I have spent about 6 hours combing through forum posts and tutorials and (as a newbie) came up with some partial solutions - just need a little help to solve it completely. Thanks!
  9. Thanks Joss, So I placed this in my _init.php file, which makes it global and available throughout the site: if($input->urlSegment1) { $localpath = str_replace("","","$input->urlSegment1"); }else{ $localpath = ""; } Now, in my top nav and footer menu, I place "$localpath" first after href=' : $homepage = $pages->get('/'); $children = $homepage->children(); foreach($children as $child) { if($child->id == $page->rootParent->id) { echo "<li class='current'><a href='$child->url$localpath'>$child->title</a></li>"; echo "<li class='divider'></li>"; } else { echo "<li><a href='$child->url$localpath'>$child->title</a></li>"; echo "<li class='divider'></li>"; } } For my top and footer logo links to home: <a href="/<?php echo $localpath; ?>" All works perfect. Now I can use Hanna Code to serve up local content for area specific AdWords campaigns.
  10. Hello All, So I've launched my first PW site: http://www.neighborhoodsewerdrain.com - yea! Next challenge: We have an 11 county service area in south east Michigan. My boss would like the site to function in such a way as to "localize" the site depending on where the user is located. So, if the user clicked on a Google AdWords ad targeted at Macomb County, the URL would be "www.neighborhoodsewerdrain.com/macomb/". From there, I'd like to pull in dynamic content specific to that region, like a local phone number, the words "Macomb County" wherever I want to drop them in the content (most likely using Hanna Code or code in the template). Further, once the user enters through the above sample URL, I'd like to prepend "/macomb/" to the root domain as the user visits other pages, which will keep the content localized. This would be ideal so as not to have to manage 11 different versions of each page. I've begun to experiment with URL Segments and PHP switch statements. I'm sure it's going to get a bit more complicated than that. So, if anyone can point me in the right direction with suggestions on how to pull this off, it would be most appreciated Thanks!
  11. Just went through everything suggested here: https://processwire.com/docs/tutorials/troubleshooting-guide/ No luck.
  12. Hey I didn't design the orignal site! The new site is staged here: http://stage.neighborhoodseweranddraincleaning.com/, but the company wants it hosted in their GoDaddy account.....
  13. I just completed what appeared to be a completely successful PW install on a GoDaddy host. I'm using a temporary sub-domain for the current main site (done in Word Press, which I'm replacing). The main site is www.neighborhoodseweranddraincleaning.com (I didn't come up with that domain name, by the way...). The sub-domain is pw.neighborhoodseweranddraincleaning.com and is now active. The install informed me that the database connected properly, etc, etc.. So now the basic PW starter home page appears at the above sub-domain, however, attempting to view another page or go to the /processwire/ admin throws a 500 Internal Server Error. This is a fresh "successful" install. Does anyone have any experience with this? Thanks!
×
×
  • Create New...