Jump to content

onjegolders

Members
  • Posts

    1,147
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by onjegolders

  1. Hmmm good point about not having to bootstrap, will have a think. I thought about adding pages for fonts but it seemed a but ridiculous having a page just to give them a font choice!
  2. Yours is way more interesting! Is there any benefit to creating a page in the admin? I'm just creating a variable $settings which is a shortcut to my settings page and then getting $settings->link_color $settings->header_font etc On another note, I'm trying to think of the best way to give them a choice of fonts (I know, I know, this is turning into Wordpress At present, I'm just using a text field and then in the description giving them choices they can enter and if they enter something wrongly, it just falls back to default font.
  3. Thanks Martijn I finally have it working with the following steps for all those interested. Create a file eg custom_styles.php outside of the templates folder <?php header("Content-type: text/css"); ?> <?php include("file://localhost/Applications/MAMP/mamp_sites/pw_template/index.php"); ?> <?php $link_color = $wire->pages->get("template=settings")->link_color; ?> .test_header { color: #<?php echo $link_color; ?>; } Make sure to use $wire rather than $pages
  4. Thanks, I just find it easier to manipulate html outside of php. Brackets, single, double quotes etc. It is a pain going in and out but I just find it easier for now
  5. Hiya, yep sorry about the mix-up that's what I meant. I've actually seen the CSS tricks article but couldn't get what he describes to work. He mentions that to get it to work on WP he had to change the htaccess file, wasn't sure if PW would be similarly effected. I can't seem to get $pages and other API calls to work in my styles.php file.
  6. Inspired by Soma's Colorpicker module I'm trying to implement some custom styles for links, backgrounds etc. Martijn said it was possible to add a php file with css in it and echo out the variables in that. I've tried but can't seem to get it going. I've added a custom_styles.php file outside of templates because I believe you cannot have PHP scripts running in there and I've added <?php header("Content-type: text/css"); ?> to the top of the file as advised by Martijn but none of the variables are getting parsed. Has anyone got anything similar working. Currently I'm using Diogo's suggestion of inline styles in the head tags but it just feels a bit wrong (but it is working)
  7. Hi Noose, 1) A page field which holds multiple pages is an array and therefore you need to loop through them foreach ($event->groups as $group) { echo "<p>$group->title</p>"; } 2) You need to set a date output on your date field in the admin area. You will be able to choose different outputs there.
  8. Soma! Don't know how many times I learn something then go to do it a while later and I have forgotten everything! So the normal variable needs to be inside the foreach loop? Edit, blank class needed to be 'item'
  9. Hi Wanze, thanks for your help (as always) but no joy. They both still add active class to all items. I'm sure I must be missing something really stupid.....
  10. OK think I've sorted it you have to store php scripts outside the templates folder. However, it's not parsing my variables, I'm getting "undefined variable"
  11. Martijn, can you give any more information on how to get this working. Did you rename your style.css file to style.php and update it in the head tag? That's what I did but don't think PW likes it as the page is coming up unstyled?
  12. I'm trying to switch from using jQuery cycle to the Twitter Bootstrap carousel and it requires the first item to have a class of "active". Sounds easy enough but doesn't seem to be working. My test is true every time and every item gets the "active" class appended to it. Any ideas where I'm going wrong? <div class="span4 offset1"> <div id="galleries" class="carousel slide"> <!-- Carousel items --> <div class="carousel-inner"> <?php $galleries = $pages->find("template=gallery, sort=-created, limit=3"); $class = "item"; foreach ($galleries as $gallery) { if ($gallery === $galleries->first()) { $class .= " active"; } ?> <div class="<?php echo $class; ?>"> <a href="<?php echo $gallery->url; ?>"> <img src="<?php echo $gallery->images->first()->url; ?>" alt="" /> <h6><?php echo $gallery->title; ?></h6> </a> </div> <?php } ?> </div> <!-- Carousel nav --> <a class="carousel-control left" href="#galleries" data-slide="prev">‹</a> <a class="carousel-control right" href="#galleries" data-slide="next">›</a> </div> </div> Funny as when i try with last() the class is applied correctly...
  13. Hi Gnome If you want it exactly like that, set up 3 templates in the backend (files, file_category and file_page) and make 1 template file (files.php) In your admin, make a Files page with template "files" then as children make Brochures and Instructions (file_category template) and then underneath these make a page for each file / or each collection of files (file_page) Eg: Home About Contact Files -- Brochures ---- Brochure 1 ---- Brochure 2 ---- Brochure Collection 1 -- Instructions ---- Instructions 1 ---- Instructions 2 ---- Instructions Collection 1 Then in your files.php file <?php include("./header.inc"); ?> <?php $file_categories = $page->children(); foreach ($file_categories as $category) { ?> <h3><?php echo $category->title; ?></h3> <ul> <?php foreach ($category->children() as $file_pages) { foreach ($file_pages->files as $file) { ?> <li> <a href="<?php echo $file->url; ?>"><?php echo $file->description; ?></a> </li> <?php } } ?> </ul> <?php } ?> <?php include("./footer.inc"); ?> Note that there may be more efficient ways of doing this, Brochures and Instructions could be there own main pages and in your template file you could find all pages with the "file_page" template and loop through the files but this way has it set up exactly how you want I think.
  14. That's true, I thought about doing that then decided not to but I can't remember why! Wonder what Ryan uses on his profile, I'll check.
  15. Yeah I think that's what's happening. I'm trying to be ultra safe with this profile I'm setting up, wasn't sure if there was somewhere to add reserved words. It's not really much of a big deal though...
  16. Gnome, To simplify: Would your files would each live on their own page, under a parent "Files"? Eg: Home About Contact Files -- File 1 -- File 2 Or do you want to be able to have "collections" of files eg: Home About Contact Files -- Brochures (can contain multiple files) -- Instructions (can contain multiple files) Do you then want to be able to link another page to these files or files collections? Or is it more simple and you just want a page where you display all your files under their respective heading (Brochures, Instructions) Sorry, just hard to understand exactly what you want to achieve.
  17. Sorry Thomas could you explain a little more what you're hoping to do? If someone goes to my-page/edit you want that page to have its template changed? You could try: <?php if ($input->urlSegment1 == "edit") { $page->template = "new_template"; $page->save(); echo "Page now has the new template!"; } ?> But I'm not sure how you want to set which template it changes to or even if this is your aim? ALSO: Have you turned on urlSegments on the template?
  18. Hi, I've just set up urlSegments on my blog template so that /blog/category/news will list all the articles with the category of news My problem is that if (for some strange reason) a blog article gets called "category" then the subsequent pages will show 404s. Previously I had it set up so the categories would just show as urlSegment1 ie: blog/news but that would also cause a collision if an article gets called "news". Am sure there's something simple I'm missing here, perhaps I have to add a reserved word somewhere?
  19. Thanks that's better though think it's lacking a });
  20. This seems to have done the trick $(document).ready(function() { $(".body_copy a:has(img)").addClass('fancy').attr({ rel: pageName, title: "title" }); $(".body_copy a:has(img)").attr("title", function() { return $(this).find("img").attr("alt"); }); }); I'm sure it can be shortened and prettified but it's seems to be working - I really need to invest some time in learning jQuery! Based on here: http://stackoverflow...following-eleme
  21. Perfect! Thanks, think the first var still needs the quotes, thanks for your assistance as ever Mr Diogo Sorry to bug you.... Any idea how to pass the images description field to the a title attr? These are images from within the body... I have this currently on the scripts page $(document).ready(function() { var title = $(".body_copy a:has(img) img").attr("alt"); $(".body_copy a:has(img)").addClass('fancy').attr({ rel: pageName, title: title }); }); Which sort of works but it always passes the first image description to each anchor tag...
  22. Thanks I've no idea why this won't work though. Code in full: Within <head> tag: <?php echo "<script><!-- define variables for JS --> var pageName = {$page->name} </script>"; ?> <script type="text/javascript" src="<?php echo $config->urls->templates?>scripts/scripts.js"></script> In scripts.js: $(document).ready(function() { $(".body_copy a:has(img)").addClass('fancy').attr({ rel: pageName, title: pageName }); }); I also tried a single attribute but the values don't get passed to the anchor tag. Strange
  23. Sorry Diogo, in your example there you put it after? I've tried putting it before and I no longer get a pageName undefined error in the console but the rel isn't getting passed to the link?
  24. Is there any way of presetting a checkbox field? So that I could have a setting default to true and the user could uncheck it if he/she so wished? I don't really want to resort to double negatives!
  25. Hi thanks for that Diogo, unfortunately it's not picking up the variable. I put the first bit of code in my head tags is that the right place? Thanks
×
×
  • Create New...