Jump to content

onjegolders

Members
  • Posts

    1,147
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by onjegolders

  1. Sorry, just running into another issue with urlSegments. I have enabled urlSegments on my "students" template so that /students/geography includes a geography_students.inc file. My problem is that underneath /students/ is the "student" template so /students/joe-bloggs displays using the "student" template but I want to add a link to "edit profile" from this particular student page and I'm trying to include an "edit_profile.inc" file but I don't know whether this would be a urlSegment2 of the "students" template or a urlSegment1 of the "student" template. I have tried both, but neither seem to work, any ideas on how to implement this? Thanks gang!
  2. I noticed that too... In the meantime you can get it off Soma's page http://somatonic.github.com/ProcessWireCheatsheet/
  3. Hi, sorry, me again, I hope these nagging questions of mine may hopefully serve other people one day I have pages which contain files, which I can then link to students and I want to be able to flash up "New!" or some such like if the file has been added or updated within say 3 days. I've figured it out to check whether the page itself containing the file has been added or modified. $files = $file_page->files; foreach ($file_pages as $file_page) { $create_date = $file_page->created; $mod_date = $file_page->modified; $date_trigger = strtotime("-3days"); ?> <li><a href="<?php echo $file->url; ?>"><?php if ($file->description) {echo $file->description;} else { echo $file->name;} ?></a> <?php if ($mod_date>$date_trigger && $create_date<$date_trigger) {echo "Recently modified!";} ?> <?php if ($create_date>$date_trigger) {echo "New!";} ?> </li> Was wondering if it would be able to go one level deeper as I have some file pages with multiple files. If not, it's no big deal, but would be helpful. Thanks again.
  4. Thanks Apeisa, helpful as always! What's the purpose of $this?
  5. Hi, was just wondering what the best way to access a page field in a selector would be? Is ID the only way? So: $geo_students = $pages->find('template=student, subject=1102, sort=title'); Or would there be another way? Thanks.
  6. Thanks Diogo i tried that but no joy unfortunately, none of the suggestions on these forums seem to work for me. Is there anything else in the RewriteBase I should be trying? Thanks for your suggestions anyway
  7. Thanks Diogo, any idea where that would fit in a normal PW htaccess? Edit; sorry just seen other -options and have added it there, just waiting to see if it works!
  8. Bumping this as have run into an issue with my PW site on a client's Godaddy setup. Only Homepage is visible, the rest go to 404. If I put gobbledegook at the top of the htaccess file, the homepage still loads so probably not getting seen by godaddy. Am having a hard time figuring out how to change what Ryan said within Godaddy, has anyone had any prior experience of this? Cheers!
  9. Can't vouch for the old version but I love the look and feel of this forum, nice one Pete!
  10. Thanks, Ryan finally figured out that having title was obsolete as at times there were multiple files to a page so I needed file->name. It seems like it was as simple as that. Thanks for all your help
  11. Hi Arjen, No, it's set to 0 but each file "page" can contain 1 or several files in the Page Tree it looks like this: Home About Files -- Geography A-level files -- Biology A-level files -- Single information file (Within all those subpages would be the files, but some subpages contain a collection of files, some will only contain a single file)
  12. Hiya thanks again Soma, If I echo $file_pages I get 1094 which I guess means it found a linked page which is good news If I echo $files I get the name of a linked file If I echo $file within the loop I get the name of the file but for some reason wrapping it in an a tag shows nothing echo $fields->get("files_link")->derefAsPage ."<br/>"; echo $fields->get("files")->maxFiles ."<br/>"; the code above outputs 0. Cheers
  13. Thanks Soma and Arjen, That looks right but for some reason it's not outputting anything, I've checked and checked again but fieldnames seem correct. If I print_r on $file_pages I get a whole page of code, I don't know if there's another way of checking the contents? Cheers for your help
  14. Thanks Arjen, it's all a bit confusing but I have: a page fieldtype on the user profile called "file_links" which relates to pages (these pages store the files) so these file pages have a fieldtype called "files". So I'm looking to output the files within the pages that have been linked to the user, the idea being that the editor can upload different files and on the user profile can select which files that particular student has access to. How to I get to output a field from within a page reference? Thanks again for you help!
  15. In a non-technical way, I think that you need to set a variable to the page-name and check that it equals the username to allow access. If you just want a sort of profile page you can set up a profile template and only display the $user information for that user. Sorry if this isn't that clear but al struggling with the concept also!
  16. Hey guys am having a bit of trouble linking users to downloadable files (which are being stored in pages). Basically I have extended the user template to include a page field called "files_link" which links to the pages where the files are being displayed. On the user's profile page (front-end) I want to display a little welcome message then the files that they are allowed to access. This is my current code, can anyone help me figure it out? <?php include("./header.inc"); ?> <div id="profile_wrap"> <?php // user is logged in if ($user->isLoggedin()) { ?> <h2>Welcome back <?php echo $user->first_name; ?></h2> <?php $file_pages = $user->files_link; if ($file_pages) { $files = $file_pages->files; ?> <h6>Downloadable files</h6> <ul> <?php foreach ($files as $file) { ?> <li> <a href="<?php echo $file->url; ?>"><?php echo $file->description; ?></a> </li> <?php } ?> </ul> <?php } ?> <?php } else { ?> <h4>Sorry, you do not have access to this page, <a href="./login">please log in</a></h4> <?php } ?> </div> <?php include("./footer.inc"); ?> Thanks
  17. Sorry to dig this up again Ryan but I don't quite understand your code above. If I wanted to replicate having a user "profile" for a student but not use the default "user" template, how could I go about logging in a student and for them to see their profile with only the files they are allowed to see? Would I log them in and then redirect them to student/my-name (where my-name is a current username - I see that I'd still have to add a student page and a user for each student?) Sorry just struggling to get my head round this one
  18. Thanks Ryan, so in short it would be preferable to use normal pages?
  19. Am trying with the user profiles. I am also trying to have a page where I list all students studying a particular subject. I've been trying to user roles for subjects but I'm having no joy with the following: $students = $users->find("roles=geography-a-level"); Would roles not be a good fit for this purpose? Am I better using page references? Thanks
  20. I'm just about to add some more functionality to a private tutor website. I would like to be able for each student to be able to download certain files. Any thoughts on whether it would be better to expand the user profile (with a files field) or to add a new page with subpages for each student. Are there any differences at all? Would I be able to display more information further down the line as simply with "user" as with a normal page? Thanks in advance guys
  21. Hiya Ryan, thanks as ever for helping out. Turns out I do get a 500 error. What could that be pointing to? A problem with my PW setup? The htaccess file itself? Thanks again.
  22. Hi guys, sorry if this post crosses over somewhat with another of mine. I've just migrated a site to a new server and as I usually do, I transferred files and folders, exported and imported db and changed config.php. The issue is that the homepage loads up fine but any subsequent pages throw a 404 error. There is a UNIX error it gives me at the bottom of the page though mod_auth_passthrough/2.1 mod_bwlimited/ Have any of you any idea what this may mean? I have tried using rewritebase as my current url does contain a "~" but alas no joy.
  23. Wanze, I've just copied and pasted your if statement and I don't believe it because it works! So strange as I have tried (or so I thought), every permutation with both single and double "=". I must have missed something out, though I was sure I tried this exact statement! Strange.... Anyway, a big thank you for all of your help.
  24. Hi Pete, sorry we must have posted at the same time! Thanks for clearing up the "=" thing. The value of project_url is a url (I guess a text string) but my if statement specifies project_url AND show_url so both criteria ought to be met before outputting the url. I'm guessing the int(0) means that show_url is unchecked? Which is sort of good news I suppose except that it's still displaying, I will have to go over it again to see if I'm missing something stupid!
×
×
  • Create New...