-
Posts
4,296 -
Joined
-
Last visited
-
Days Won
79
Everything posted by diogo
-
That's right, notice that this is a string. But that part of the code was written by Pete, credit is given in the code
-
The beauty of it is when you realize that you can do absolutely anything with PW if you keep only these two concepts in mind: everything is a page the cheatsheet is your friend not a lot to learn, hein?
-
A SuperBatcher! I love the idea
- 33 replies
-
- 2
-
- crud
- handsontable
-
(and 3 more)
Tagged with:
-
Create custom forum with great admin capabilities
diogo replied to dhruba's topic in Getting Started
That's why I would avoid working directly with the db tables. The db structure was built to maximize the power of the API, and this is PW's big strength. You can accomplish virtually everything with the API in a very cool and easy way If you forget the db and focus on the tree. -
Create custom forum with great admin capabilities
diogo replied to dhruba's topic in Getting Started
Just to give you an idea of the huge task that you are looking for, not even these forums were done with Processwire. But besides behing a CMS, PW is also an excellent framework suitable for building anything that you would build on another framework. Including a forum. As for your question: You could build a module that hooks on page delete, checks if the page is a user (if template is "user" would be enough), and looks for all the pages (posts would likely be pages in PW) that were created by that user to delete them. You could also simply delete the pages by the user by his request. Considering that it would be the user deleting himself, just look for his pages and delete them before deleting the user: foreach($pages->find("createdUser=$user") as $p) { $p->delete(); } If you are aware of the amount of small tasks you will have to code to create the forum, this gives you an idea of how easy is to solve them with PW. -
Understanding and Reusing navRender function in the Foundation Profile
diogo replied to Zahari M.'s topic in Getting Started
Pagination is easy to implement and is very well explained here http://processwire.com/api/modules/markup-pager-nav/ If you have any specific doubt, ask away -
Understanding and Reusing navRender function in the Foundation Profile
diogo replied to Zahari M.'s topic in Getting Started
The first one is more reusable. If for some reason you would want to render the posts on another page, or simply use a different array then children, you wouldn't be able to do it with the second option. But, if you do this: function renderBlogPosts(PageArray $items = $page->children) { You can call the function with renderBlogPosts() on the original page, but be able to pass a parameter on any other page: renderBlogPosts($pages->find("template=post")) -
I'm revisiting the site on my mobile and it feels great! I like particularly the summary on the posts pages I'm also loving the posts. Next on my list is the one about caching.
-
I have to agree with Adam concerning the logo as the kerning doesn't work at all. If the font doesn't have a good kerning by default, the best thing is to build the logo on a vector software, and use an image. Or if you feel like, just envolve each letter in a span and have fun http://letteringjs.com/, http://kerningjs.com/ and practice a lot http://type.method.ac/
-
Understanding and Reusing navRender function in the Foundation Profile
diogo replied to Zahari M.'s topic in Getting Started
$items is a parameter of the function. When you use the function like this: renderNav($page->children), the array $page->children will be attributed to the variable $items inside the function. exactly the same as if you would do: $items = $page->children. that function could have been written also like this: function renderNav($items, $options) { instead of: function renderNav(PageArray $items, array $options = array()) { The difference is that, in the second example (the real one), the function is forcing us to use a PageArray for $items, and a regular array for $options. Plus, in the second parameter, the function also defines a default value to $options (in this case, an empty array), so you don't have to define a second parameter when using the function. -
Corrected. The forum should throw a PHP error when you make those mistakes while writing directly in the browser
-
Complementing Ryans code. If you have a page field on the user template that points to one city page, and you have the ads as children of pages: if($user->isLoggedin()) { // display ads from your city foreach($pages->find("parent=$user->city" as $ad)){ echo $ad->render(); } } else { // display all the ads foreach($pages->find("template=ad" as $ad)){ echo $ad->render(); } } Of course it has to be even more complemented with pagination and those things... but it gives you an idea
-
This conversation is being very entertaining so far. Please keep on edit: kongondo, you are my hero!
-
Get first image and title of children pages
diogo replied to AnotherAndrew's topic in General Support
Back to English. The rest of you, just ignore. We were talking about the FC Porto new football coach, and somehow @nfil added port wine to the conversation- 16 replies
-
- 2
-
- first image
- children
-
(and 1 more)
Tagged with:
-
Get first image and title of children pages
diogo replied to AnotherAndrew's topic in General Support
Estou contente com o Fonseca, vamos ver no que dá- 16 replies
-
- first image
- children
-
(and 1 more)
Tagged with:
-
You're just trying to be nice By reading it again, it can't be right...
-
You're right... I read understood it wrong! delete everything
-
Get first image and title of children pages
diogo replied to AnotherAndrew's topic in General Support
In your code, everywhere you have "$page", replace it by "$chosenPage", and above that code do something like: $chosenPage = $pages->get("/the-parent-page/");- 16 replies
-
- 1
-
- first image
- children
-
(and 1 more)
Tagged with:
-
Maybe the best would be like I told on the edit. To keep everything separated and connected with page-fields. No, where you read "ad 1" i mean "ad 1 from user 1" and "ad 1 from user 2"
-
Edit: ignore this post. The reason is explained by kongondo three posts below I would do it in a different way. Since the city is associated with the user, makes less sense to have the ads as children of the cities. I would probably put the ads under the user himself. Like this you would have cities and categories as page fields. users -- user 1 ---- ad 1 ---- ad 2 ---- ad 3 -- user 2 ---- ad 1 ---- ad 2 categories -- electronics -- furniture -- books cites --city 1 --city 2 edit: the ability to have the ads as children of users depends a lot of how you will create the users. But you would get the same effect by having all the adds under a "ads" parent, and connect to the user with a page-field or simply using "$page->createdUser"
-
I think this tutorial by @kongondo will be very usefull to you http://processwire.com/talk/topic/3579-tutorial-approaches-to-categorising-site-content/
-
In your case I would use a repeater with a url field and a text field. People can add as many links as they want and it's clear what goes where. On the template you just have to do: foreach($page->links as $link) { echo "<a href='<?php echo $link->my_url_field; ?>'><?php echo $link->my_text_field; ?></a>"; } or, maybe better: if(count($page->links)) { echo "<ul class='links-list'>"; foreach($page->links as $link) { echo "<li><a href='<?php echo $link->my_url_field; ?>'><?php echo $link->my_text_field; ?></a></li>"; } echo "</ul>"; }
-
Ryan, speaking of responsive, you might want to increase the z-index of the social buttons (100 is enough), and make them position:fixed. As it is now when I close the browser window they go under the pictures and when I scroll horizontally they move away from the window side.
-
You don't have to apologise to my facebook friends, unless I can have the friends without having an account... You can apologise to my cousins though