Recently Browsing 0 members
No registered users viewing this page.
I'm struggling with this : a 'group' field of 'Page' type.
The parent of selectable pages is '/groups', the template is 'group', and a member can create some groups in the /groups tree. I would like this user to see only the groups he or she has created so in my 'Find selector' in the backend, I would like to use :
template=group, created_users_id=$user->id But that doesn't seem to work... I still get the list of all available groups in the /groups tree.
Any idea ?
I had a feeling I had already seen that before (something like $user->id must be replaced by users_id or something, but I can't find anything in the Forums... and all my tests keep failing...
So, I really don't know where to begin with this. I have the thought in my head (the basics), but not really sure how to set it up.
The desired effect:
The homepage is set up with a foreach loop that outputs all the child pages (basically just a bunch of pages with pdfs, docs etc stored in a file field). When A user is actually logged in, they can "star" an item or drag and drop (using Dragula) the page to a sidebar. Also, they would be able to reorder the pages in the sidebar.
I guess I have multiple questions regarding how to achieve this.
Would it be best to create a page field in the user template to save the page(s)? How would you actually save the page state (sidebar output, reordering, etc) once the drag and drop has been used? Thanks in advance for any help! A lot of this was just what was in my head, so it might not make full sense. However, I will update this if I can actually wrap my head around everything.
I'm wondering about creating a query that involves looking across two different parent page trees.
One parent is for blog posts and it has each post under that.
Another parent is used for categories and subcategories for the blog.
Then in the blogs there is a page field that can reference the categories. This is all pretty normal setup so far.
I created a navigation that lists the current category and its children, but I want to not show categories that have no posts. For some reason I'm drawing a blank.
So let's say a user clicks category1, and it shows a blog listing for that category. I query for all the child categories of the current one. Now I want to exclude any categories where NO blogs exist that make reference to the category (an unused category). How do I do this in a way that is performant? I don't want to have to query the blogs tree over and over to test for the presence of each category in the list!
Here is the tree:
- article1 [pagefieldcat = "cat1"]
- article2 [pagefieldcat = ""]
Now when I get all children of categories, I want to exclude cat2 since it's not referenced from any blogs. Can I do this without having to loop and query every category against every blog one by one?
By Michael Steinmann
i guess my php knowledge is not good enough to find a solution for the following problem:
I'm building a website where i have projects. Each project has tags like "webdesign, responsive, cms, print, flyer" etc. At the end of a project i want to recommend other projects, which have similar tags. I want to limit the recommendations to three other projects sorted by the hightest amount of same tags.
This is how far i got:
<?php $interessantes = $pages->find("tags=$page->tags, id!=$page->id"); ?> to find other projects with the same tags, excluding the page i'm already on.
Then i'm using three foreach-functions to go through the projects i found, the tags they have and compare them with the tags of the project i'm looking at. If i have two identical tags, i count up a variable.
<?php // Projects i have found foreach($interessantes as $interessant): $i = 0; // Tags of the projects i have found foreach($interessant->tags as $tag): // Tags of the project i'm looking at foreach($page->tags as $tagreferenz): if($tag == $tagreferenz): $i++; endif; endforeach; endforeach; endforeach; ?> You can see what it looks like in the screenshot with a bit of HTML. I marked the tags of the current project green and the identical tags of other projects red with the amount of hits below. So in this example i would want to have three projects with three similar tags and get rid of those with only two and one.
I guess i have to put my pages into an array (with the number of hits?), sort them and echo them with "limit=3"? Unfortunately i have no idea how to do this. You probably have an even better/shorter solution. Links to other topics are welcome to and i'll try to get my head around it.
If you need further explanation, i'll try my best.
I'm trying to sort pages based on their parent's fields, which are page references.
$someOrders = $pages->find("template=order, sort=parent.customer.id"); Here, order's parent has a template called 'orderslip' that has multiple 'order' children. Orderslip contains a page field called customer, and I want to sort based on the parent's customer's id. But i can't make it work. It throws out an exception:
Error: Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'customer' in 'order clause' (in /srv/rewwwards/wire/core/PageFinder.php line 410) I'm sure customer page field exists and it works everywhere else. It's just that this time, I'm trying to sort it from a page's 'parent' selector. Is it even possible do this?
As always, any help is greatly appreciated. Thanks.