-
Posts
1,147 -
Joined
-
Last visited
-
Days Won
4
Everything posted by onjegolders
-
Investor area, best way to layout permission-only pages
onjegolders replied to onjegolders's topic in General Support
Thanks Diogo, will give this a try! -
Was just wondering how feasible/complicated it would be to display 3 blog entries, followed by 3 images which will be stored in the blog-index page, followed by the next 3 blog entries, then the next 3 images and so on and so-forth? I'm currently converting a static site (where this was obviously simple) and as a PHP beginner, I would ideally like to know whether the code will become so complicated that it's better to say to the client "Hey let's do this a different way". I had a quick play around and I made a blog entries loop then an images loop, problem is I don't know if it's possible to loop them within another loop... <?php // Show 3 blog entries $entries = $page->children("sort=-sort, limit=3"); $count = 0; foreach ($entries as $entry) { $count++; $class = "blog_box"; if ($entry == $entries->last()) {$class .= " blog_box_last"; } if ($entry == $entries->first()) {$class .= " blog_box_first"; } if (0 == $count % 2) { $class .= " blog_box_even"; } ?> <div class="<?php echo $class; ?>"> <div class="blog_text"> <h3><?php echo $entry->title; ?></h3> <h6><?php echo $entry->entry_date; ?></h6> <p><?php echo $entry->body; ?></p> </div><!-- /.blog_text --> <?php if ($entry->image) { $image = $entry->image->width(350); ?> <img src="<?php echo $image->url; ?>" width="<?php echo $image->width; ?>" alt="<?php echo $entry->title; ?>" /> <?php } ?> <div class="clear"></div><!-- /.clear --> </div><!-- /.blog_box --> <?php } ?> // Show 3 blog images <?php $blog_images = $page->get("image_uploads")->find("limit=3"); foreach ($blog_images as $img) { $b_img = $img->size(200,140); ?> <img src="<?php echo $b_img->url; ?>" width="<?php echo $b_img->width; ?>" height="<?php echo $b_img->height; ?>" alt="<?php echo $b_img->description; ?>" class="small_frame" /> <?php } ?>
-
Sorry I'm not a GIT user so just posting here what I think is a tiny bug or if not, just something that I noticed. When filling in a title, if you press TAB to use a browser autocomplete suggestion, then the URL stops getting autopopulated. I'm sure you are aware of this and there may be no easy way round it but just thought I'd point it out. A few times I've not paid enough attention and ended up with funny urls!
-
Investor area, best way to layout permission-only pages
onjegolders replied to onjegolders's topic in General Support
Thanks Dave, was just re-reading Ryan's last post with a fresher pair of eyes, I think he means that if someone puts in or is linked to /rates then you CAN output a template without there actually being a page. My preference would be for there to not be a new page, just a new view of the same content. That way the client could put all the property info on one page in the backend. Then in the portfolio_entry template I could check if they had certain permissions and if so link them to /rates for example and then they'd be shown a template with investor-specific information on it. Sorry if this is making no sense at all! I think the best way may be that I just give it a go and see where it ends up. -
Thanks Arjen
-
Investor area, best way to layout permission-only pages
onjegolders replied to onjegolders's topic in General Support
Thanks Ryan, but correct me if I'm wrong, if we wanted say the 'rates' for 'Property 1' in the properties section, then the page properties/property_1/rates would still need to be created in the backend? So essentially each property would end up with a child, all called rates? These could then be referenced with urlSegment but I'm presuming you couldn't just give an href to a non-existent page and then create it on the fly? Sorry for being so slow here -
This thread and Teppo's reply helped me figure out it was a permissions issue. I changed assets to 777
-
For some reason I can't login after migrating my site from local to live. I'm pretty sure it knows the password is good as when I enter a bad one I see "login failed', when I enter the correct one, it just seems to redirect me back to login. Has anyone else had the same problem? Thanks
-
Investor area, best way to layout permission-only pages
onjegolders replied to onjegolders's topic in General Support
Thanks Diogo but I don't quite understand where you would put that code? Would this be a way of reusing a pages content in a different template? -
Investor area, best way to layout permission-only pages
onjegolders replied to onjegolders's topic in General Support
Sorry, I'm picking this up again and trying to look at it from a front-end point of view as well. If on my portfolio-entry page I want to have a link to the investment details for this property I need to send the link to an actual page don't I? Because I had merrily gone about creating a new template called investment_details.php which called it's parent, got the data from there and displayed it in a different way. But I'm now realizing that for this "page" to exist at all front end then there needs to be an actual page generated back-end, by the client underneath the particular property. Am I getting this right? If so is there any other way of displaying a different template for the same page? (So that there doesn't need to be 20 sub-pages for 20 property investment details)? Thanks again and sorry for dragging this out (I think my brain has gone back into EE mode) -
Investor area, best way to layout permission-only pages
onjegolders replied to onjegolders's topic in General Support
Thanks a lot Diogo, I will take a look in detail at this later on. Cheers! -
For my page titles, I have found another way of doing it with the following code: <title>Site Name | <?php if ($page->rootParent->title != $page->title) {echo $page->rootParent->title . " | ";} ?><?php echo $page->title; ?></title> Would still be interested to know if you can echo or use urlSegments in if statements though. Thanks
-
Is there a way to echo a URL segment for example to use in the <title> tag? Eg: <title><?php echo $page->title; ?> | <?php echo $input->urlSegment(2); ?></title> The above code was my stab at it but I'm not sure if segments can be called in this way? Sorry, should point out that this is within a header.inc template
-
Thanks Soma for your help! I had forgotten siblings included its own page.
-
Sorry, should be something basic but can't seem to find the answer in here. If I want a section with a header ie: (Other news articles) to display only if the page has siblings, how would I go about checking that in an if statement? I have tried: if ($page->siblings) if ($page->siblings()) if ($page->siblings->id) if ($page->siblings.count > 0) I find myself always guessing at the different ways on testing whether or not something is empty or does not exist. Is there a general rule? This might help me clarify when to use which of the above! Thanks guys.
-
MadeMyDay sounds like an excellent project, I for one think that it would be a very useful addition!
-
Investor area, best way to layout permission-only pages
onjegolders replied to onjegolders's topic in General Support
Thanks Diogo, I have seen them I'm just not sure how to use them in this case (where investors are $users with role of "investor" and they are only related to certain properties) -
Investor area, best way to layout permission-only pages
onjegolders replied to onjegolders's topic in General Support
Sorry Ryan you've lost me there! Could you give me a quick example? -
Investor area, best way to layout permission-only pages
onjegolders replied to onjegolders's topic in General Support
Any particular way you could tie a property to a user? I suppose you would need a separate role per property? investor_property1, investor_property_2? Thanks again -
Investor area, best way to layout permission-only pages
onjegolders replied to onjegolders's topic in General Support
Thanks Ryan. I think this is definitely the best way to go. If I had a whole page (or template) of specific information for an existing (public) property could I then go one level deeper? Something like: site.com/properties/property-1/investor-view ? I just think it may arise that the client wants a whole bunch of information for a particular investor. I guess then there would need to be a role per property? -
Just trying to get my head around this one and was wondering how you would play it on your sites? I have a property portfolio page with different properties as children. This should be visible to all visitors (no problem here) There also needs to be property-specific extras for people who are logged in as "investors" (role already created) I'm just trying to think hierarchically the best way to go about this. I currently see two options but I'm hoping there are more, or that I'm missing something. Option 1: Create an Investors page and repeat the portfolio children underneath - The downside of this I suppose is that the staff would had to add a property twice and repeat all the content? Option 2: Use same "Portfolio" and "Portfolio-entry" templates and then add permission-only content to these templates such as: <?php if ($user->hasRole("investor") == 1) { ?> // some code here... <?php } ?> This could be a better option but I'm wondering how cluttered the templates may get. Would just be interested in your thoughts on how you may go about this? Thanks!
-
List all siblings exclude current page
onjegolders replied to onjegolders's topic in General Support
Yeah I think sibling would imply that it excludes the current page but the result in the end is OK. I would guess this sort of code is used quite a lot for articles, blogs, related entries etc... -
List all siblings exclude current page
onjegolders replied to onjegolders's topic in General Support
Think I may have sorted it with: <?php $siblings = $page->siblings(); $siblings->remove($page); foreach ($siblings as $sibling) { ?> <li><a href="<?php echo $sibling->url; ?>"><?php echo $sibling->title; ?></a></li> <?php } ?> Would be interested in finding out if this is the right way of going about it or I just got lucky? Thanks. -
Was just wondering about the best way to show a list of siblings (in this case other news articles) in the sidebar without also showing the current page article? Currently I have this but not sure on how to "offset" the current page: <?php $siblings = $page->siblings(); foreach ($siblings as $sibling) { ?> <li><a href="<?php echo $sibling->url; ?>"><?php echo $sibling->title; ?></a></li> <?php } ?>
-
Thanks Apeisa, this helped me too.