-
Posts
4,296 -
Joined
-
Last visited
-
Days Won
79
Everything posted by diogo
-
You can easily list all pages that have pending comments and link to their admin pages like this: foreach ($pages->find("comments.status=0") as $c){ // status 0 means pending echo "<li><a target='_blank' href='{$config->urls->admin}page/edit/?id={$c->id}'>{$c->title}</a></li>"; } If I have time tomorrow, I can try to make a process module with this, so you can have the list on an admin page.
-
When you use a page field you can always relate the pages both ways. Only the way you call them is different. You call B from A like this: $page->pagefield and A from B like this: $pages->get('pagefield=$page') where A is the page that has the page fieldType
- 8 replies
-
- 1
-
- reciprocal
- pages
-
(and 1 more)
Tagged with:
-
Welcome newbie I did a small change to the code, so it includes the self page on the tree. EDIT: the code I posted wasn't working. Using the same code you posted here, just change the end (after the function closes) to this: $homepage = $pages->get("/"); $menu = treeMenu($homepage, 3, ""); echo "<ul id='myMenu'>"; echo "<li class='level0'><a class='level0' href='{$homepage->url}'>{$homepage->title}</a>"; echo $menu; echo "</li></ul>"; This is not a very elegant way of doing this. Would be best to change the function. But it works.
-
I wasn't clear enough. To be clear now, the image is the result of this code foreach ($input->urlSegments as $segment) { echo "<h3>{$segment}</h3>"; } added on top of the default site-map template
-
Bug?? I was showing that it works! edit: the image was to show that the segments are working well. What did you think was a bug? That there is one page with English name? If it's that, don't worry, that's the only one that I didn't define a Portuguese title
-
@diogo
-
It's true, it doesn't work. I tested it with a urlSegment and it did work: elseif (count($users->find("name=$input->urlSegment1"))) Anyway, for sure you will want to sanitize that data, and use it somewhere else on the code. So, I think the best is using the variable instead of calling it directly.
-
Nice, looks like a good solution. But wire('users') here is not different $users. You can make it smaller like this if you prefer $username = $input->post->signup_name; elseif (count($users->find("name=$username"))) { $output = "<h6 class='error'>Unfortunately that username is taken, please try another.</h6>"; }
-
Like that you are comparing an object with a string. maybe this will work elseif($users->get("name=$input->post->signup_name")) //returns null if not found, so it should work for the condition I can't test it right now, but hope it helps
-
Hello and welcome to the forum This is exactly how Processwire is designed to behave. All the fields in the CMS are custom. You just have to create them, give them a field type (image, textarea, checkbox, etc...) and populate the templates with them. then, you had the template to a page, and all the fields are there to be easily edited. You will see that it is very easy to get used to templating in PW. To make it short, imagine that you created a field called "client_email". You just have to do echo $page->client_email to output it on the site. Beyhond this, it just gets much more powerful.
-
Great!! Everything is working very well on a fresh PW install with only this module activated. The navigation and all the links of the default site with the original code unchanged work very well. Suggestions for the Docs: instruction to check "Allow Url Segments" on the language template is missing. would make sense to suggest to check "Hidden: Excluded from lists and searches" on the language pages.
-
Because users and roles are also pages, you just have to use a normal "page" fieltype for this. When creating the field, go to the input tab, and choose user as the "template of selectable pages". Still on the input tab, insert roles=1013 on the "Custom selector to find selectable pages", where 1013 would be the ID of the given role.
-
You changed a lot since the last time Glad it's working, but I think it shouldn't work like this. The normal behavior is that it isn't considered an array only if the limit of files is set to one, and not if there's only one file uploaded. Can you check this?
-
Thanks for the changes mcmorry! Sorry if I didn't understood that some things that I asked were already implemented. I must confess that the development of this module is way too far of my understanding of how PW works... I will keep following it mainly as an observer Yep, I'm also sorry for this. I guess I'm better at reading english, than at reading code You can change this limit on the config.php file $config->maxUrlSegments = 4;
-
This should do what you want //inside a foreach($page->images as $image) if($page->images->last() === $image) { echo $whatsnextclass; }
-
Better add $years = array(); before the foreach, so that in_array($.urlyear, $years) doesn't throw an error.
-
I would like to throw some ideas to the discussion. As I understand, if you put the id on the segment, the search will be faster and less expensive, but the content will be the same as in the url without the id (am i right? I'm not sure...). Won't this duplicated content be bad for SEO? Maybe there can be an option on the module to turn this on and of. In this case you would do one thing or the other, but not both at the same time. Would be nice to just use $page->url normaly. Isn't it possible to replace $page->url for these pages, instead of creating the new mlUrl method? The main thing I don't like about this method is loosing the ability to use the urlSegments. I was wrapping my head around a way of, somehow, recognize that the segments are being used for this, and what segments are not. Maybe the module could allow the developer to declare on the template that the last (n) segments should be ignored and used normally --of course there would have to be some kind of reajustment to make $input->urlSegment(1) behave like $input->urlSegment(1+(number-of-segments-used-by-the-module)) on the template.
-
inside the foreach: if (!in_array($urlyear, $years)) { // you have to create an empty $years array somewhere before echo "<a href='" . $urlyear . "'>$urlyear</a><br/>"; $years[] = $urlyear; }
-
Ideas for a dashboard / widget system?
diogo replied to MadeMyDay's topic in Module/Plugin Development
for developers: cheatsheet tip of the day -
Don't forget to change the file extension to .php If you changed them to php, they will appear on "templates found" when creating a new template. The files I was talking about were the old html files, now turned in php files in step one. For the css files and images, you can keep the exact same structure you had. Just move the folders where they were to the templates folder also, so the relations are the same (this will work only if the paths are relative of course).
-
Welcome to the forum jufo! First, make sure that the template of the new parent page allows children. On the page tree, the new parent page has to be open. Click on "move" on the page you want to move, and when dragging the page insist a bit, sometimes it can be tricky to put it on the exact place when the parent doesn't have any children yet.
-
So, maybe you will like this hosting service https://www.nearlyfreespeech.net/ Just be aware that, because the nature of their service they take security to an extreme level, so some CMSs might not work. But if you will use something like gpEasy, it shouldn't be a problem...
-
Hey! Although ProcessWire is fairly simple, you won't put it to work without some effort. If you are willing to try, we will be here to help for sure. Still, maybe you should have a look at these "put on the folder and go" self hosted CMSs http://gpeasy.com http://www.razorcms.co.uk/ edit: ah! by coincidence, gpEasy was referenced on another thread today have a look at it http://processwire.com/talk/topic/1365-inline-editing-the-drupal-spark-way/#entry12240
-
I just wanted to say that you can easily put static html files inside PW with all the advantages: nice urls, making them appear on dynamic navigation and searches, or being able to make them dynamic quickly, to name only few. For this, you just have to put them on the templates folder and change the .html extension to .php. Then, go to templates in PW and create a new template for each one, and associate them to these files. Then, create the pages on the tree and choose the correspondent template. That's it! There are also advantages on keeping them as static files of course, being speed the most obvious.