Jump to content

RyanJ

Members
  • Posts

    208
  • Joined

  • Last visited

Everything posted by RyanJ

  1. I am currently using pagination on my search results and just realized that I get a 404 error for any page number exceeding 999. works fine www.mysite.com/url/search/page999/ Does not work, 1000 or greater returns 404 www.mysite.com/url/search/page1000/
  2. After both Ryan and Teppo pointed me in the right direction, I tried using ftp to create a symlink with no luck. However, FireFTP claims you can but I have not tried it. On a side note, I figured out that my host by default disables shell access and mentions very little about it. After contacting them, they enabled it for me with no problems. Also, this is not related to PW, but helped make the picture clearer. Just my 2 cent.
  3. I could be wrong, but shell access is required to run the above command.
  4. Thanks Ryan, that helps clear the murky water
  5. I would really like to get a detailed understanding of the Skyscraper profile functions file. These particular questions are in regards to the following two functions 1. function getValidSkyscraperSorts() { return array( // field => label 'images' => 'Images', 'title' => 'Title', 'parent' => 'City', 'height' => 'Height', 'floors' => 'Floors', 'year' => 'Year', ); } The above returns and array of fields and their labels, but what if you just had one field and label. No need for an arrary, so how would that look? 2. function renderSkyscraperListHeader() { // get the 'sort' property, if it's been used $sort = wire('input')->whitelist('sort'); if(!$sort) $sort = 'title'; // query string that will be used to retain GET variables in table header sort links $queryString = ''; // make a query string from variables that have been stuffed into $input->whitelist // to use with the table header sort links foreach(wire('input')->whitelist as $key => $value) { if($key == 'sort') continue; $queryString .= "&$key=" . urlencode($value); } $out = "\n\t<thead>\n\t<tr>"; // build the table header with sort links foreach(getValidSkyscraperSorts() as $key => $value) { // check if they want to reverse the sort if($key == $sort) { $key = "-$sort"; $value = "<strong>$value »</strong>"; } else if("-$key" == $sort) { $key = ltrim($sort, '-'); $value = "<strong>$value «</strong>"; } $out .= "<th><a href='./?sort=$key$queryString'>$value</a></th>"; } $out .= "\n\t</tr>\n\t</thead>"; return $out; } The above is very well explained, but lets say that you do not want to output the header sort links because you already have the header labels elsewhere. Or lets say you only want to be able to sort 2 of the 6 fields instead. Whats the best approach to sort just one or two of the 6 fields without outputting them all in the above function? For example, I would like to sort Height and Year only.
  6. Yes, I am using the module as I type. If the folder only gets created when the page is created or saved again, then that is promising and the lazyCron will work perfectly. Most of all my pages uses the image field. Thanks for that idea and the module recommendations. It's great to have such creative people that are willing to assist and also the ones creating great modules. Currently I have 51063 pages using the image field.
  7. Thanks for the module, its a great solution. In my case though it will not work because of the following clause "Pages with file/image fields require a directory, so you should expect that some of the removed directories will be re-created by these". I am using the image field and due to the amount of pages I have, I am getting an excessive amount of asset file folders created that are not necessarily needed at this particular time. Maybe Ryan or someone can offer a solution to my problem.
  8. Hi, I am having the same issue getting the "destinationPath is empty or does not exist" message, but only on certain directories within the site structure. Can someone advise on how I could create the directory manually or where should I start to look for an explanation? Thanks **Update It is a server issue, apparently I have to many folders in the assets files. Is there a way to prevent a folder from being created unless an image or file is uploaded?
  9. Hi nfil, Are you still having problems? Also, when you try to access http://site.com/site-otherdomainname, you should get a forbidden message, so you may want to look at the permissions you have on that folder.
  10. That has been my nightly reading for the past two weeks.
  11. Hi Nik, I appreciate your detailed explanation and gain to absorb as much as possible, so please continue to get carried away. You answered a second question I had in my head but never asked. So the find() method gets pages and the get() gets a page? Again Sir, I cannot thank you enough.
  12. Hi Nik, Strangely enough I had tried the has_parent last night after I learned it from your first lesson, but it did not work. I was either tired, delusional or thinking I misspelled location because it works perfect this morning. So to break down the code to make sure I understand it, $departmentSelector is grabbing all pages with the department template the if is checking if the current page is using the template location and if so, it is grabbing that pages id and appending it to $departmentSelector? You sir have excelled as my hero to now my Super Hero!
  13. Hi Nik, As you suggested, I am currently using this in searchform.php to pull in all of the departments in all locations. <?php foreach($pages->find("template=department") as $department) { $selected = $department->id == $input->whitelist->department ? " selected='selected' " : ''; echo "<option$selected value='{$department->id}'>{$department->title}</option>"; } ?> I took your snippet and altered it to this but with no luck. I am not getting any results with it. <select name="department"> <option value="">Any</option> <?php $departmentSelector = 'template=department'; if($page->template == 'location') $departmentSelector .= ", parent=$page"; foreach($pages->find($departmentSelector) as $department) { $selected = $department->id == $input->whitelist->department ? " selected='selected' " : ''; echo "<option$selected value='{$department->id}'>{$department->title}</option>"; } ?> </select> I was initially thinking of an if/ elseif statement or better a switch to check and see what location page the user was on and then just grab the locations department/year children, but If there are a lot of locations, this could be very time consuming and as always, thanks for educating us newbies .
  14. Nik, your FieldtypePage tip with the id's as the reference worked perfectly. Add one more day that you are my hero .
  15. Just a follow up question if I may. What logic would you recommend to only show the available selectors in the search form per location. For example Location 1 --employee --- Jane Doe --department --- Newbie -- year --- 2012 location 2 --employee --- John Doe --department --- Newbie Trainer --year ---2010 Department children pages and year children pages are page fields and are both drop downs in the current search form. So when I am on the location 1 page, currently it shows all children of department and year from both locations. Is it possible to only show the children of the location you are one. So if I am on the location 1 page, the search forms drop down would only show the Newbie department and the year 2012. If in location 2, the search form drop down would only show department Newbie Trainer and Year 2010. Hopefully I explained this well.
  16. Hi Nik, I can not thank you enough. My first trip to Finland will be to buy you some beers or food or whatever. I will heed your advise and be sure I describe my problem thoroughly before I post it to be sure it is understood completely from others perspectives other then mine. I thought I had a good grasp on what I was trying to learn/achieve as this is just a mock site for me to learn from, but I was a tad bit over my head. I still have one other part of the form that I need to tackle, but I will attempt to achieve those results a few more days before asking for help. Thanks again and cheers!
  17. Hi Nik, ahhhhh, you are a kind soul and life saver! Yes, I have debug on and has_parent seems to work with no errors and although I only have two locations now the proper results are appearing. I did not see has_parent in the selectors cheat sheet? Any other selectors out there not on it? I cannot thank you enough for your help. I owe you BIG!
  18. Hi Nik, Definitely leaps and bounds from where I started, but I am getting no results found if a location is selected. The correct id's are showing in the url, so I am assuming it has something to do with the $selector maybe? Thank again for helping me out and cleaning up my mess . Looking at it further, I think because "Location 1" is not the actual parent of the list of employees, but "employee". Is there anyway to go one step down further? I guess I could just delete the employee container.
  19. haha, Yes, version control would be nice and a mess is kind words for what I have and I do sincerely appreciate your patience. This is day 4 of figuring out my mess. I fixed this part as I realized it was not correct by any means and I'm a silly person for not realizing it. The first snippet is from searchform.php which contains the drop down. So in the drop down are the options "location 1" "location 2" The second is from search.php and is supposedly my logic to process the selected location. My goal is in my search results is to output all employees that are children of its selected location. Location 1 Location 2 are both assigned the same template named "location" Each employee is assigned a template named "employee" The employee template does not have a field of location, they are just children of their location. Here is a post of my complete structure. It may help you understand my logic and once again, I appreciate your time as I am trying to learn pw, so I dove in deep.
  20. Hi Nik, Thanks for the response and advise. The $selector is used in a function to find the results. After reading a whole lot, I saw that Ryan recommended using integers, so I replaced $location->name with $location->id. I think the problem I am having is that I have to grab each location. In my search form, I want to just grab all results pertaining to whichever location is selected.. I have updated the above code and the structure. Maybe it will help explain a little better. Thanks again.
  21. Need some help with these this filter if anyone can point me in the right direction. I altered the below from the skyscraper profile to meet my needs, but can not seem to get it to work in my case. The actual drop down on the form works properly displaying all locations, but I cant get the output to search what is selected. What am I missing? I am trying to grab all the employees when a specific location is selected. My structure is root Location 1 - employee -- jane doe -- jone doe Location 2 -employee -- jane smith form drop down for child page <select name="location"> <option value="">any</option> <?php foreach($pages->get("/")->children("id!=10") as $location) { $selected = $location->title == $input->whitelist->location ? " selected='selected' " : ''; echo "<option$selected value='{$location->id}'>{$location->title}</option>"; } ?> </select> output for child page if($input->get->location) { $location = $pages->get("template=location" . $sanitizer->pageName($input->get->location)); if($location->id) { $selector .= "location={$location}, "; $input->whitelist('location', $location->name); }}
  22. ** Moved to its own topic here
  23. Hi Pitbull, I hope this first part will help you get started. I have not figured out the output of the form yet, but hopefully I will soon or some other generous soul will have time. Since pw has now become my go to tool because its cool like that , I decided to build a mock site so I could use it as a reference library. I want to learn as much as I can about it, so I was interested in this concept here and I am using this structure. After building every thing successfully to much satisfaction and ease with pw I thought it would be awesome to add some search functionality. Please note that I have never built a search form to this degree, so it could be completely wrong. Also, this is just the form part and I am still working to get it to output (which im struggling to achieve). This is all based off Ryan's skyscraper example. So with that said, I thought each employee would have the fields of first name, last name, job title, department, year and to complicate things a bonus pay which is in currency format . Here is how I output all of that. *note, I removed the markup to cut down on the size of code for demonstration purposes. $employees = $pages->find("template=employee, limit=10"); foreach ($employees as $employee) { //This outputs the "location" the employee is from. This is also a drop down in the search form. echo $employee->rootParent->title; // Text field in search form, so is last name, job title and bonus pay echo $employee->first_name; echo $employee->last_name; echo $employee->job_title; //This outputs the "department" which is a page field and is a drop down in the search form. echo $employee->department->title; echo number_format($employee->bonus_pay, 2); } Now to the search form. All is pretty self explanatory except for the bonus pay part. I wanted to challenged myself (which has now seemed to result in defeat) but, I thought It would be nice to add the ability to search a range of values for the bonus pay field. Again, this is a mock site to learn from and this form may be completely wrong, but it does work for me so far. I am simply attaching it as a reference and for anyone to critique. I am half way through the output (search.php) and will add it when I get it working. Maybe someone else smarter then me can help out, but here are a few examples. // This builds the selector string as noted by Ryan in his example $selector = ''; // this gets the first name field..... all other text fields should be similiar if($input->get->first_name) { $value = $sanitizer->selectorValue($input->get->first_name); $selector .= "first_name%=$value, "; $input->whitelist('first_name', $value); } Update! The form needs a little bit more work, but I will repost it and document it when I clean it up.
  24. Thanks for the additional option Wanze. I guess this just proves the saying that pw gives you complete flexibility to handle things in multiple different ways.
×
×
  • Create New...