-
Posts
4,320 -
Joined
-
Last visited
-
Days Won
80
Everything posted by diogo
-
My point exactly. You wouldn't want php newbies to be looking at your first years code for sure edit: just to clarify. I'm not saying that you shouldn't look at code from others, and in this particular place, you can rest assured that Ryan's code will have very few inconsistencies or errors. But when not knowing the basics, you can be confused even by small tricks used by more experienced developers, like purposely assigning a value to a variable inside a condition if($summary = $page->summary) //do something if $summary exists
-
@photoman I'm not sure if this is what you want, but here goes: <?php foreach($page->children as $child) { echo $fredi->render("all|the|fields|you|want", $child); echo $child->render(); } ?>
-
The lesson to take here is that you shouldn't be looking at php code without learning at least the basics. IMO the best way to start is by reading a good introdutory book on php, and only then start looking at code from others.
-
Did you load fredi before? $fredi = $modules->get("Fredi");
-
Redirect admin view links for one page website?
diogo replied to photoman355's topic in General Support
What happens with render is that the $page object is momentarily replaced by the rendered page, so if you render a page inside the homepage, and in that page template you compare $page != $homepage, this will always be true. By doing like I did, you are comparing the real url in the browser with the rendered page url. This means that if the page it's called directly, the real url and the url from the $page object will match, but if the page is rendered from another page they won't. -
Make sure you do it a odd number of times, so Ryan gets at least one like from you
-
Redirect admin view links for one page website?
diogo replied to photoman355's topic in General Support
Macrura, your solution won't work because inside the render() the $page object is the one from the rendered template, so ($page != $homepage) will always be true. But the same can be achieved by testing agains the url: if($page->url == $_SERVER[REQUEST_URI]) $session->redirect($pages->get(1)->url."#".$page->name); and in the homepage, something like: foreach($page->children as $p) { echo "<div id='{$p->name}'>"; echo $p->render(); echo "</div>"; } -
I really think the best way is to use pages. If you organize things well, those pages will never get in the way of the main structure because they will be collapsed under their parent. This is how people organize data in computers for years. The fact that you use pages will allow you to use the api, and this will make it so much easier to create a frontend or backend system to consult that data.
-
Quick and dirty solution would be to had this line to your admin-theme: $(".Inputfield_repeater .ui-sortable > li").addClass("InputfieldStateCollapsed"); you could add it in the end of the main.js file for instance $(document).ready(function() { ProcessWireAdminTheme.init(); // very dirty hack to collapse the repeaters, make something nicer later $(".Inputfield_repeater .ui-sortable > li").addClass("InputfieldStateCollapsed"); });
-
Ah, ok! I got it now
-
I didn't mean to do it on the repeater field settings, but on the settings of each of the fields that are inside the repeater. I will try it. edit: it seems to work:
-
How come a new vps has a software that ended in 2010 installed? Is that normal? Did a small search and ubuntu 10.04 was already coming with php5.3 packaged... Anyway, apparently you can upgrade php with a dist-upgrade
-
Still not clear. You say 4 tabs, but there are only 3 there. Can you make a quick sketch to explain?
-
@jsantari, If I understood well, this module is intended for the images in the back end only. All it does is to replace the fancybox module that comes in the core. If you want a lightbox for the front end, just choose one and follow their instructions. If you have trouble to generate the required markup with PW, we will be here to help @nikola, maybe you can make this more explicit in the documentation?
-
You can define that option on the fields themselves. Go to input -> visibility, and choose "always collapsed". If it works on templates, it must work inside repeaters... But in my opinion, if you feel that need, you shouldn't be using repeaters. Repeaters are supposed to make your life easier and spare you from some clicks, not the opposite. If what you describe is happening, I would say, use normal pages instead.
-
The find method only accepts the pw selectors. What you are doing there seems very different to me to what Soma did in that example. The way Soma concatenated that string I can see that it will be something like this (just guessing, i didn't look at his code); // $selector = any selector f.ex. "template=basic-page," // $_REQUEST['iDisplayStart'] = 10 // $_REQUEST['iDisplayLength'] = 20 $pa = $this->pages->find("template=basic-page, start=10, limit=20"); which is a valid selector. In your selector the result of the concatenation would be something like this, right?: $values = $pages->find("parent=/LIMIT0,15"); // ?? You can't use regular mySQL queries because they won't be recognized by the method. If you want to use queries you can use query() http://processwire.com/talk/topic/2209-display-data-from-mysql-table/?p=20630
-
Body text HTML has no line breaks in code
diogo replied to Peter Falkenberg Brown's topic in Getting Started
Nik, I'm just fooling around your correction was useful for sure -
Body text HTML has no line breaks in code
diogo replied to Peter Falkenberg Brown's topic in Getting Started
@Soma: A tiny typo in your verb, change cab to can. -
Yes, $pages of course The selector I used was just for testing. It was the way that I had to form a decent array with find in a default installation
-
It was a typo indeed. I will correct it. Thanks nik.
-
You can put a checkbox on the home page, or a config page, and then something like this in the head.inc (adapt to your situation): if($maintenance && $user->isGuest()) $session->redirect($page->get('/maintenance/')); These tricks can also be tweaked to that effect http://processwire.com/talk/topic/2475-quick-tip-for-testing-on-live-website/ edit: adrian, in pw there is always an alternate way