-
Posts
6,798 -
Joined
-
Last visited
-
Days Won
158
Everything posted by Soma
-
It's there already
-
Hey statestreet, congrats on your album and cool site there you got! Thanks for sharing.
-
Congrats, you just opened a big new magic box there! Have fun
-
I thought this should work, but not sure why you want to get page by process. I now there's $page->process to get but why can't you just use name? Do you have multiple pages with the same process? Maybe possible to use a prefix in the name and do a search "name^=prefix" to get all. ?
-
Ah, yeah I think that's what I'm looking for. page-add permission. I was a bit confused to why it isn't there. So I went over it again where my main problem was and where I thought about having this option. It would be for pages I want to give the editor rights to edit but not add new pages with it. But when I give edit permission, it shows up in the template select. I agree that we should keep this access things as straight and easy as possible, but such an option would greatly help and not add too much complexity. Though I was already a little confused not really because it's complicated but because I haven't slept much for a long time . I really would like to have this out of the bo, maybe not installed but there in the package. Yeah I'll be glad to give you access though PM. So only if you like, you don't have to. As I mentioned most templates are for having flexibility, and most are purely there for structuring. I know there would be different ways to archive the same, and have the logik in templates using let's say ID's or paths instead based of template name. I just think the ability to structure the templates with something like "tags,categories" could help to reduce the template list to what you're looking for. I think this can come in handy too when dealing with large sets. I know there's filters, but they're not the same.
-
You can just use: $articles = $pages->find("category=$page, limit=50"); The $page is the current category page, which serves also as the catergory page to select in the articles. So category is a page reference field on the article pages. Also you could use template with urlSegments enables to setup a page "categories" that lists pages from a category, you can use like: /categories/categoryname/ Then use something like this: $cat = $sanitizer->pageName($input->urlSegment(1)); $articles = $pages->find("category=$cat, limit=10"); Edit: Sorry corrected some in the code, its $input->urlsSegment() not $page->urlSegment(). And $sanitizer-> not $page->sanitizer
-
I think what you experience is what we got in this thread http://processwire.com/talk/index.php/topic,558.0.html It's basicly the problem that the jquery ui datapicker date format isn't compatible with php date format. I spent some time to do a mapping array for converting (as you see at the end of the thread) , but ryan hasn't implemented it yet. I think it would work with simple dates, but not for times. I'm not sure how well this can be implemented for datetime fields and datepicker with time select addon).
-
A different way of using templates / delegate approach
Soma replied to Soma's topic in API & Templates
Great to see and know we kinda got same spirit here, you also seem to use similar approaches! Should have posted that earlier, I think it's pretty much needed this kind of threads sharing ideas. As with other parts of PW that still seem to be undiscovered for some people. (was surprised some people here didn't knew there were a tabfield they could use). Not that I think is a problem, but maybe we should start getting/pointing those things out more, even if it's just in threads like this. Back to the template thing. I also use main.php with basic html frame with head and body, and maybe a div wrapper, and the page template includes some structure that is different from page to page layout, though still it's enough flexible to extend and based on variables or template do different things like sidebars. I'm also trying out to use it the other way round much like your's Ryan. Also having structure and data more separate can help a lot. While I'm still using the echo "<p>$somevar</p>" quite a lot now in PW, I think it's not really the best way to build. Mixing php and html can lead to messy code and cluttered, noisy, harder to maintain. I'm strictly going down that road now again and still thinking about different approaches. A template parser would be handy but can create some limits at best and it's slower at the end of the day. - The other day I was trying to code one simple module to use for blog/news type listing, just for fun. Mainly to try out coding a tag parser, and ended up with the plain php and the template parser approach right in front of me, and the knowledge creating this yet simple but hard to still programm little module. I came to the conclusion, that I still prefer pure php since it can do the same with a little more code but be alot more flexible to me. – But still I'm also thinking it could simplify some tasks, and maybe still be useful to the less experiences php newcomers. It would be easy possible within PW to create markup-generating type of modules. Not sure If that should be done, as It's a little against PW's philosophie. But I really like pre-created profiles! As mentioned also in another thread, I think this could get possibly a big thing. I like the idea of having ready to go installs, and you Ryan already created the tool to export site profiles. Best part of it It can help some newcomer peoples so much, I think this should be considered quite important thing we should ignite as soon as possible. Well not trying to push things. I'm sometimes really impatient when something new excites me. -
Yeah Nico, because I loaded the latest commit... but I meant the "site" link overlapping navigation.
-
-
Yeah, glad you like the module and even have added things! - Though I don't see the benefit of seeing 10/5 that much but nice touch. - To see the installed ones on hover. How would this look with the 30 Fields? I thought it's nice but not something I would want really. But don't hestitate to make adaptions to your likeing. You could fork mine on github and let other people use it?
-
I found (after 2-3 Projects using PW) that it's a good technique to use templates in a way I think hasn't been thought of yet really by some. (Although the CMS we use at work for year, works this way.) I'm sure I'm maybe wrong and someone else is already doing something similar. But I wanted to share this for everybody, just to show alternative way of using the brillant system that PW is. Delegate Template approach I tend to do a setup like this: - I create a main.php with the main html markup, no includes. So the whole html structure is there. - I then create page templates in PW without a file associated. I just name them let's say: basic-page, blog-entry, news-entry... but there's no basic-page.php actually. - Then after creating the template I make it use the "main" as alternative under "Advanced" settings tab. So it's using the main.php as the template file. - This allows to use all templates having the same php master template "main.php" - Then I create a folder and call it something like "/site/templates/view/", in which I create the inc files for the different template types. So there would be a basic-page.inc, blog-entry.inc ... - Then in the main.php template file I use following code to delegate what .inc should be included depending on the name of the template the page requested has. Using the TemplateFile functions you can use the render method, and assign variables to give to the inc explicitly, or you could also use just regular php include() technic. <?php /* * template views depending on template name * using TemplateFile method of PW */ // delegate render view template file // all page templates use "main.php" as alternative template file if( $page->template ) { $t = new TemplateFile($config->paths->templates . "view/{$page->template}.inc"); //$t->set("arr1", $somevar); echo $t->render(); } <?php /* * template views depending on template name * using regular php include */ if( $page->template ) { include($config->paths->templates . "view/{$page->template}.inc"); } I chosen this approach mainly because I hate splitting up the "main" template with head.inc and foot.inc etc. although I was also using this quite a lot, I like the delegate approach better. Having only one main.php which contains the complete html structure makes it easier for me to see/control whats going on. Hope this will be useful to someone. Cheers
- 83 replies
-
- 27
-
I just updated the sheet. - added fix to menu when scrolling - moved some entries to advanced mode - added toggle button on sections - minor changes Hope it still works well for you guys.
-
Thanks Ryan for the answer. Well the setup of the templates so far work fine regarding access and family. I use it inheritely and am using the family settings sparely and only for allowed childs. I played around with it quite a lot. But what I'm requesting is not this, my idea is to be able to say "this" template is only allowed to be selected (when creating a new page) by a certain role. So that templates only I should be able to select aren't visible to the editor when creating new pages. For example a special form-template. So while I could make it not to be in the allowed family of one or another template, I would need to add it temporarely, just so I am able to create a page with it. Hope you understand what I mean. I got that many because it demands that many (I was already cautious on not having too much), and they're not all for pages only. Some are for folders, different types of page elements (as childpages, guess this will get better once we have repeatable, flexible elements on page), some ar for different types of downloads (also as pages) and download folders to be able to select them and have all downloads listed from that folder. There no way to do it different or with less templates. While It was my first big, more complicated and multilangauge project with PW, I think some could be simplified. But I already got a main sub-page template which is used for the majority of page thoughout the site and has many fields and tabs for different elements, to keep it flexible and not create a template for each type of page. Edit: I understand your suggestion to make this kinda work on a per role/template basis, but it's not practicable in my setup. May if you want I can give you acces to the site, so you could take a look?
-
I want to be able to say on a per template basis, what role can use the template for new pages. Further considerations regarding templates setups I got pretty big setup with many different types of templates. I have each of them set up to allow only certain children and/or parents etc. This is great to reduce the selection one has when creating new pages, and allows for some great control. Sometimes it is may even needed to only allow a certain template in a certain section. But this may goes too far, but depending on how you use PW to build sites, it can be a neccessary feature. THis can get endless I thought and I can't wrap my head around this particular problem what is best way to go. This is very nice but can get a little cumbersome to manage and maintain, as there's no overview (especially for new admin that are new to a project). Mainly it's hard to keep track of what is where how it inherits. It is easy if there's only a handful of templates, but I got around 40 templates and it's still growing. But I guess that's the nature of having so much templates. And I fear that the level of complexity can get worse as a project grows. What would be the best practices, or would there be a way to solve it all different and more convinent? I would like to discuss this a little more and like to hear what others think. Also what are your plans on this subject Ryan?
-
Congrats on the Site. Looking good. One thing that came to mind: The top main nav has no highlighting.
-
Not sure about this. I thought about it too, but didn't feel it's needed. I mainly use search function or the left index, I never find myself scrolling really.
-
That would be great to have. Thanks for bringing it up Nico. Can someone please shift time 2 years forward! Can't wait for all these features to come. --- Oh, would it need to be automaticly or lazy cron, just a manual check would be enough?
-
tsd, if you need more help just ask here. I'm sure we can find a solution that suits your needs. But first try out and think what would be best for you. Let us know what you come up with using.
-
That would be the 1000th thread asking for repeatable/multifields already. I think they're are planned and on Roadmap
-
Why not? Actually pretty fine solution to add it in page to be able to say where it should go. There's actually some different ways you could archive something like this. - add a field for selecting what navigation the page should go. - add a structure to define navigation. Special type of pages where you can select what page should have link in footer navigation. - same but only one page with page reference field - add the 2-3 links manually to the footer nav code. And make them hidden in admin. - by a special template for footer pages.
-
Sure you can with no problem, just have to remember it.
-
Progress on ProcessWire 2.2 and overview of multi-language support
Soma replied to ryan's topic in Multi-Language Support
I'd vote for as much as possible, bring them all. ;D But it's a valid question and should be well considered. Mainly the end user is the most important. But I think about site builders that don't speak well english, so I would go for complete, although this would add much more work and every future modules would need some translation... so definately worth considering having "system" section english. – Damn I couldn't decide. -
I'll add mine too. Just waiting for godo.