Jump to content

photoman355

Members
  • Posts

    51
  • Joined

  • Last visited

Recent Profile Visitors

3,579 profile views

photoman355's Achievements

Full Member

Full Member (4/6)

5

Reputation

  1. Many thanks guys. I knew about the prepend option but it doesn't solve the problem because then you get this structure in the nav: Root Home Page 1 Page 2 Root's name should be the name of the "Home" page. I have come up with a solution for this which solves the menu problem however it doesn't create a permanent redirect for the root/home url and it breaks my scrollspy for some reason. <?php $root = $pages->get("/"); $child = $root->child(); if ($child) { echo "<li class='#{$child->name}'></a><a href='{$root->url}'><h1>{$child->title}</h1></a></li>"; } $root = $pages->get("/"); $first = $root->child(); $children = $root->children()->not($first); foreach($children as $child) { echo "<li class='#{$child->name} {$active}'></a><a href='{$child->url}'><h1>{$child->title}</h1></a></li>"; } ?> @kongondo's Your suggestion of putting the redirect in the Template for Home makes a lot of sense but I still need to pull in the code from Home to the Root page so would need to bear that in mind. I'd definitely need the menu to tie up. Can you suggest how I'd go about this? From an SEO point of view is changing the menu enough to stop robots finding the root/Home url? @Wanze I know it's a bit of a strange setup. I have several pages as content blocks so putting them in the backend structure as suggested could get messy from a client point of view. If Root was Home it would look something like this: Root Block 1 Block 2 Block 3 Page 1 Block 1 Block 2 Page 2 Block 1 etc
  2. I have a slightly unusual setup where I'm using the first child of the root as my homepage like so: Root Home Page 2 Page 3 etc This is presenting me with a slight problem in that I need the Home url in the navigation tree to redirect to Root. Here's my navigation setup: <?php $root = $pages->get("/"); $children = $root->children(); foreach($children as $child) { echo "<li><a href='#{$child->name}'></a><a href='{$child->url}'><h1>{$child->title}</h1></a></li>"; } ?> I'm sure there's a nice easy way to do this in PW, can anyone help? For data setup I have Home rendered in the Root page. Looking at SEO would simply changing the menu structure be enough to stop robots indexing the root/Home url so that Home is seen as Root?
  3. Thanks apeisa. I'm guessing it's quite a complicated issue. Any plans to fix in a future update?
  4. I've come across an error which is stopping fredi working with images in repeater fields. I'm not quite sure why it's happening but this seems to be on all my templates with repeaters that contain image upload fields. As an example I have a carousel as a repeater (code below). If the carousel is filled with images from the backend it works perfectly. When I try to fill it with images using fredi on the frontend the edit modal pops up as expected and the "choose file" button for the field brings up my file explorer. When I choose an image you can see that the image is trying to load but nothing happens. The strange thing is this only happens with images. I have other repeaters that contain both images and text and the text can be edited with fredi, just not the images. Is this a bug or do you have any suggestions to fix the error? Here's an example of my setup: Call fredi at the top of the template: <?php $fredi = $modules->get("Fredi");?> Example of an image repeater I'm using: <?php foreach($page->sliders as $k => $slider) { $active = ($k == 0) ? " active" : ""; $image = $slider->image_single->size(660,220); echo "<div class='item {$active}'> <img class='photo' src='{$image->url}' alt='{$image->description}' /> </div>"; }?> Call the fredi edit link at the bottom of the template: <?php echo $fredi->render("sliders");?>
  5. Fantastic info Soma, lots of code to try out. I really like the last method using hooks, seems like the closest I'll get to $page->body->limit(150). Will have a play around. Many thanks for all your help on this.
  6. Hmm...not as simple as I thought. @alanfluff Thanks I knew about the admin side limits but the problem with adding a limit to a field is that you have to create a separate field for each size of text you need. So for example if I was reusing <?=$page->body?> multiple times the text limits would have to be the same. @MatthewSchenker I had a read of the forum, really useful module. In this case I can't use it as it uses the same way as Alan's method to set the limit. @Soma This is exactly what I was after, many thanks. I noticed you wrote this as a function. I take it this is pulled from a functions.php file much in the same way as wordpress? To save writing lots of code this makes a lot of sense. If I wanted to apply the function to say the $page->body tag would I use a get call first or is there a better way?
  7. I'm sure the answer is fairly simple but I was wondering if there's an easy way to define the number of lines for a textfield in a template. I know you can set size limits for images fairly easily using $image->size(100, 100); but wondered if there was the equivalent for text?
  8. Thanks apeisa I didn't think of that. For anyone else who's interested just add this to your header instead of the usual call. Nice and simple. <?php $fredi = $modules->get("Fredi"); if ($user->isLoggedin()) { echo $fredi->renderScript(); };?> Totally understand your reasons for making the column widths 100% as the original concept was about editing on a field by field basis. My sites are built in blocks and I find myself grouping fields on a block by block basis as it's quicker for the client to edit and means I can output less edit links. It would be great to have the markup available to target with css even if it's not used in your default css file but either way I'm very happy. So good to have fredi.
  9. @apesia I've been happily playing around with Fredi and have a small suggestion. The echo $fredi->renderScript(); call is only required when the user is logged in but at the moment it's printed in the header regardless of whether the user is logged in or not. I know this won't have a massive impact on page load speed but it adds another 2 http requests which aren't really necessary. Just a thought. On a slightly different note I noticed that the admin field column widths are not reflected on the front end. I'm not sure if this was on purpose to keep things responsive? Here's what's missing: class="InputfieldColumnWidth InputfieldColumnWidthFirst" (These styles are in UI.css) and also the inline style that defines the width in the backend eg "width:20%".
  10. Aha! That did it. In the end I didn't need to write the code as above, all that's required is $fredi at the head of the child template like so: <?php $fredi = $modules->get("Fredi");?> Then just call as normal using $fredi->render("heading|body|etc"); Many thanks for your help apesia and for writing such a cool module
  11. Thanks diogo. I tried your solution but I still can't get it to work. When I add your code to the parent template file and view the result the page renders fine but there are no fredi links. Here's the code I entered. <?php foreach($page->children as $child) { echo $fredi->render("body", $child); echo $child->render(); } ?> What I'd expect to happen is all the children that have a body field would be rendered with an edit link. I tried various multiple field combinations but no joy. I'm not quite sure why it's not working. For simplicity sake let's say one of the child templates was just this: <div class="span4"> <?=$page->body?> </div> What's the best way to work with fredi using the example above. Does it need to be called from the parent page template or can it be initialised in the child template itself?
  12. Thanks guys. @adamspruijt, I never thought of adding blocks like that. Definitely fast to deploy a site but one advantage of building with blocks as children is the blocks can be changed without touching the source. I'm sure this could be set up via an of options page though. @diogo Looks like a fairly straightforward solution, look forward to testing it out. Much appreciated.
  13. @apeisa This module is fantastic!! It makes editing so much easier. Thank you. I've been playing around with the various configuration options and have come across a problem, possibly because of the way my site is built. I can get fredi working on pages that call in a header and footer but can't get it to work on my content blocks. For setup I have a page with header and footer that pulls in children as content blocks like so: <?php foreach($page->children as $child) echo $child->render(); ?> I tried targeting the child pages using $pages->get in the template file but it doesn't seem to work. I'm not sure if this is because the blocks have no header and footer or if it's because fredi can't find them. Is it possible to use fredi in this way or maybe to target the block template itself?
  14. Many thanks Ryan. The 404 the page in question is a site-settings page that has no associated template file. Would a processwire 404 from this page not be output as plain text anyway as there's no header and footer or would a 404 still show the admin header and footer? I'm sure you're right in saying it's mod_security anyway. My hosting company are useless
  15. Thanks guys. @adamspruijt I'm not quite sure what you mean by Do you mean creating templates via admin without creating a physical template file? All my blocks contain markup so they're built as separate eg block.php files. I'm not familiar with the repeater field technique for content blocks. Can you explain a bit more? One workaround I thought of would be to add this to my admin template css which solves the problem up to a point. .content .PageListActionView { display: none !important; } I was hoping there would be a nice simple way to handle it in Processwire. I know there's the redirect module but that's not ideal is it involves specifying each url and all I really need is a global rule that says - if child redirect to parent, or something like that. @Macrura can you give me an example of how I would add a redirect to a template?
×
×
  • Create New...