Jump to content

RyanJ

Members
  • Posts

    207
  • Joined

  • Last visited

Posts posted by RyanJ

  1. Have you tried using $page->find? I was having some issues using $page->get and switched to $page->find and was able to achieve the results I wanted. I do not completely understand the difference between "get" and "find" though.

    For an example, I cannot get this to remove the specific page id

    foreach($pages->get("/")->children()->remove("id!=100") as $location)

    *Edit, Fix the above and now works fine.

  2. Based on the structure below, "employee", "department" and "year" are simply place holder "pages". Each have been assigned a blank template and contain only a title field which is required. They serve no other purpose.

    The issue I was seeing is that I could access these pages in the url directly. For example, root/location1/employee/ would simply display a blank page. This is undesirable for me as it made me fell empty :) and marking the page as hidden in the back-end did not resolve the issue. So I saw the option unpublished in the back-end and it works perfectly.

    I then found Ryan's post here which explains a lot but this example I think deserves its own topic. Would my handling of this be considered advisable or would something else be a better solution, like a 301? I noted that marking a page hidden excludes it from the find() method, but I simply grabbed the children by their templates.

    Location 1
      - Employee
         -- John Doe
         --Jane Doe

      - Department
        -- Confused Department
        --Even More Confused

       -Year
        -- 2013
        -- 2014

  3. Hi Pitbull,

    I am currently working on a search form that has drop downs of categories, input fields and allows you to search a range of values, in my case it is ages. I will be sure to share my code when/if I ever get it completely figured out and working. I am new to pw and have a basic understanding of php, so I am taking Ryan's example from the skyscraper profile and altering it to my needs. 

    Hopefully I can get it complete soon and share as many others do in these forums.

  4. Okay, so I figured it out sorta.

    I had to change the field type to "Single page (Page) or empty page (NullPage) when none selected" instead of the multiple pages. Also if I tried the single page boolean, I threw this error "Trying to get property of non-object".

    Maybe someone can educate me today :) on how this would work or if it could work with the multiple page array?

  5. Hello,

    Im using the following structure

    Location 1
      - Employee
         -- John Doe
         --Jane Doe

      - Department
        -- Confused Department
        --Even More Confused

    Each employee is assigned a department which I am using a select page reference field. I need to be able to print the title of the department.

    I am using the following to output my fields, but for the "department" field, I can only get it to print the id.  I am assuming this is because its only a page reference field as to why it will not print the title.  Any tips are appreciated

    $employees = $page->find("template=profile");
             foreach ($employees as $employee) { 
              echo '<tr>';
                 echo "<td>{$employee->first_name}</td>";
                 echo "<td>{$employee->last_name}</td>";
                 echo "<td>{$employee->job_title}</td>";
                 echo "<td>{$employee->department}</td>";
                 echo "<td><a href='{$employee->url}'>Profile</a></td>";
                 echo '</tr>';
     

    I have tried 

    echo "<td>{$employee->department->title}</td>";
     

    with no luck

  6. I am seeking some advise on option 2. Simple Multiple Categories for my structure.

    Basically I have several locations that will list employees. Each location will have different employees.

    Each employee will have at the minimum a First Name, Last Name, Title, Department, Age, Image, Year.

    Employee Fields would be: First Name, Last Name, Title, Age and Image which will be unique to each employee.

    Department: An employee may belong to one department and in rare cases maybe more. A department will have multiple employees, 

    the departments will vary per location.

    Year: Same as department

    The most important part that I need to confirm is that on the front end, the user will need to be able to search the employees by first name, last name, department, year and a range of ages IE  Low____ High____. Ideally the first name and last name will need be input fields and the rest could be a drop down.

    Location 1

      - Employee

         -- John Doe

         --Jane Doe

      - Department

        -- Confused Department

        --Even More Confused

       -Year

        -- 2013

        -- 2014

    Location 2

        " "

    Location 3

       " "

    So my question is am I on the right track and is it possible to create the search functionality that I would need with the above layout? Thanks in advance for any tips, advise, recommendations or silence :)

  7. Would really like to know if any was able to get option 1 here working with hostgator? I have set up everything perfectly, but for some reason it does not want to point the sub-domain.

    Update!

    After banging my head for a few days. To "point" a domain in most shared hosting accounts is to "park" a domain. Now that I feel dumber :), I hope someone else will find this useful. It works perfectly!

    • Like 2
  8. Hi Ryan,

    Thanks for the reply.  I did think of a new pw install per sub-directory, but thought it would be less maintenance if I had one core. Ideally the project I am working on is one site, but I need a separate database per directory.  I looked into the sub-domain and completely overlooked the initial sentence on your instructions of pointing the sub-domain to the main domain. I have not tried it yet, but everyone else has seemed to accomplished it, although I am a little confused on how the url would work if the sub-domain is pointing to the main domain.

    In regards to the symlink, I am not familiar with them at all, so I will need to look into how to work one up. Thanks for the info and hopefully I will figure out the symlink part. If not I might just go the easy route and do a new pw install per directory. Although I will have a significant amount of directories and could see space being an issue.

  9. Hi Diogo,

    Thanks for the quick response and link. I was still unable to get the subdomain to work properly. I think I will just do a new pw install on my local and export it to the live sub domain db when I am done. Sounds like it might be easier and quicker :) Thanks again.

    After looking at the apache error log, it looks like it was looking for the subdomain folder within the wamp/www/ directory. Note sure how to get around that. 

    I had also misunderstood the forwarding of the sub-domain as well and think this is only possible by creating a new dns record. I would be curious if any others have manged to set it up on a local environment. Or I could be completely over my head (which is more likely possible) :)

  10. I happened to run across this today and thought I would share. I don't know your level of understanding for basic programming, but I sometimes like to revisit the basics. Although php is not used here, its the same concept. The instructor here makes it very interesting with her enthusiasm, that is actually entertaining. I hope someone just starting out may find it useful. Here is the link

    • Like 1
  11. Hi cmscritic, I just want to note that you now have the <h1>-Tag filled with an image, and only with an image.

    Hhm, dunno if this is a good idea with respect to SEO and page semantic. (But my profession are the images, not SEO or semantic, just doesn't feel good to me)

    I agree, if just using the image, ditch the <h1>. From your first post, I think you were trying to replace the headline text with the logo if I understood correctly.

  12. I initially thought that'd be the way to go too... but ended up questioning if it's inefficient somehow to have a bunch of fields that would hardly ever be used. And perhaps also a bit cluttered when posting (probably not that bad for a personal site, but maybe not so great for someone else or a client per se).

    The cool thing about the fields is that you can just collapse them in the back-end if they are not used that often. And when you need them, just un-collapse them. 

  13. I think you will find what you are looking for in the main.inc file on line 60. You could try to add something like this to that file. 

    if($page->image) echo "<img src='{$page->image->url}'>";
     

    Check out this for outputting images if you have not already.

    **Disclaimer, I have not tested it and could be completely wrong. I'm still learning myself, but thought I would give you my 2 cent. :)

  14. Hi Grays, 

    I personally would stick with one template and use an if statement to check if it has a value or not. No need for two templates which could later cause confusion. I would create two separate fields for the images. 1 for the body text and image, then 1 for the image gallery.

    The body field is likely to spit out <p> tags and your <img> within it. (although you can have it spit out whatever you like)

    The image gallery field, you could spit out a list of images and it would allow you to do all sorts of things with them using jquery or css.

     Just my opinion though.

  15. @Grays, do not feel alone. I too am new to ProcessWire and still trying to put things together. Although I have been working with WordPress for a few years now and have spent many hours trying to hack the default ways of it, I still consider myself very green when it comes to php.  I have went through each tutorial on here and read them twice. I then just started building in my local environment,  I built 4 simple demo sites as reference libraries in 24 hours. I also am trying to just learn the in's and out's of the framework. I am looking forward to working/learning with it and will keep an eye out for your questions as I am sure I will have the similar ones.  :rolleyes:

    With that said, my opinion is to just dig in and build.

    • Like 1
×
×
  • Create New...