I'm working on an Yii application and I have a particular action that renders a page which is separated in 3 different sections. Let's say that the first section displays items from the database from Class A, the second displays items from Class B and the third from Class C. Each class section is in different div and each section could contain a lot of items.
My goal though is to display only 8 or 10 items per section from the respective class and then provide paginator links to navigate to the rest of the section's items. I have all the items in three different arrays and I can display them with no problems, however, without the pages functionality. In a nut shell, I need to somehow make 3 different paginators work on the same page and I have no idea how reading the yii pagination guides so any tips are more than welcome. Thank you!
I think that you had forget the pageVar in your CPagination.
Related
I'm building a "project" for school in php and
i'm here because i'm having some issues. I'll explain:
I have 4 lists of items , each one is associated with a class (that the user chose in a configuration page) which are saved in a database. Inside each list are listed the students belonging to each class.
Using the sortable jquery method i was able to make it so that i can drag a student from a class to another, that i was able to do and is working as intended.
I was satisfied with what i had so far (since this is the first time i've done something similar). However, my teacher asked me to put below those 4 lists the rest of the classes in divs or something so i could move a student from each of the 4 "important" classes listed above to one of those "lets call it other classes" making the student change class (change a field in the table students via ajax or smthing) and make it disappear from the page.
I dont know if i made myself clear because my english is not that good but i'll try to make an example.
Let's say i had 7 classes in my database. (A, B, C, D, E, F, G) and i had defined that the "main" ones are A, B, C and D. Those main classes would be in the lists at the top and the other 3 would be below the lists (the difference is that they wouldnt be lists, so they wouldnt show the associated students and if a dragged a student from any of the main lists there). Now there's the important part Lets say i drag a student from List 1 (class A) to the div below that corresponds to class E, it would change the students class to E and it would remove it from the page, or hide it, since it doesnt belong to any of the big classes anymore. This is what i cant figure out how to do
Image to help understand: http://tinypic.com/view.php?pic=mtb96s&s=8#.VYP00PlVhBc
Image link2: http://prntscr.com/7irm41
Does anyone have suggestions of how i could achieve this? I can post some code so let me know if i need to
In the query, you can use ORDER BY for the ordnung of the elements.
Figured it out!
Used the draggable!
https://jqueryui.com/draggable/
I want to load all categories grids on one page and want all products to be available on scroll down. currently I need to click on each category and the page refreshes for each category. This is the site I am working on(ahmad.esy.es). I want this type of functionality upon clicking the category(http://www.just-eat.co.uk/restaurants-hertsplaice-en11/menu#2254). kindly suggest me what changes should I make in view files (product.tpl, category.tpl) or controller files(product.php, category.php). how can I load all the grids of categories in one page
I didn't look at the site you have posted above - if you cannot describe your issue by words or by submitting a code or image it should be improved.
From what I understand you just want an infinite scroll to display all the products you have in your eshop. It is not mentioned whether you want to preserve the default functionality (category tree with products attached to certain categories) or whether you want only this one listing - basically it does not matter - so I will describe in short how to add such new functionality.
The model
you do not need to touch any model - you can reuse the method ModelCatalogProduct::getProducts()
this will give you the possibility to sort or filter the products except you will have to omit the filter_category_id to load all the products
The controller
feel free to create a new controller (e.g. ControllerProductInfinite) or just to reuse one of the already existing - either ControllerProductCategory or ControllerProductProduct
all you need is basically the same as in ControllerProductCategory::index() except adding filter_category_id into a array passed when calling ModelCatalogProduct::getProducts() and a new template for rendering
The template
create a new template that will meet your expectations and infinite scroll requirements
stick to any infinite scroll plugin/implementation you like (may Google be with you)
This is a very newbie question so bear with me. I'm starting to use Yii as my first PHP framework and so far so good, the project on wich I'm learning is a simple informative webpage, but how am I supposed to handle the subpage concept under Yii? This is what I'm trying to achieve:
Home
Products
Product 1
Product 2
Contact
I have a controller for Home, Products and Contact, now I know that Yii doesn't work with subcontrollers, then how do I create a Product 1 and 2 subpages? Just a different view for each one? Through Gii? Many thanks.
You could do one of two things
You could have a generic product page that accepts a parameter to distinguish between different products (common approach). For example,
www.mysite.com/products?id=1 would show Product1's page whereas www.mysite.com/products?id=2 would show Product2's page (and if there is no id parameter in the query string, then you could just show your Product page)
And you could also have separate methods for each page. So you would have
actionProduct
actionProduct1
actionProduct2
methods in your Product controller and then you could reach your pages as
www.mysite.com/product
www.mysite.com/product1
www.mysite.com/product2
I'm trying to link together a number of pages in a regular flow in Drupal. The way I've been doing it recently, is to create a new Menu and then seperately create a page for each menu item.
For example, I have a menu block with links One through to Six. I then create six pages and link One to node/1, Two to node/2, Three to node/3 and so on.
This is fine, but I'm told that I can create a number of story nodes instead, and they'll link together at the bottom of the page like so (http://imgur.com/xCtYe) without my intervention, almost like a linked list of page nodes.
How would I achieve this?
I worked it out. I had to enable the book module. Co-worker just explained to me after reading the question :)
You might also check out NodeQueue
I see you already solved it, but just FYI, you can also use the Custom Pagers module to do this as an alternative to the book module. Here is an excerpt from its project page:
... allows administrators to define context-sensitive previous/next pagers for any node type. The list of nodes to be cycled through is generated by a user-selectable view, and each pager can be displayed above or below the node body or in a sidebar block. This makes it possible to duplicate the paging functions of forum.module and book.module, as well as more complex stuff like comic strip navigation.
I developed an application with different MVCs using the Yii Framework
For example
I created a crud layer for Student Contact details and Student Courses etc.
All worked perfectly since each had its own menu, and when clicked eachs own view rendered.
Now my client wants everything on one page, and is quite persistent, we are talking about 7 MVC that need to be displayed on one page. Each MVC has it's own controller, model and view and own DB table. How can I render all of them on one page without re-writing the whole application? Is this possible.
If I understood your problem correctly, you simply want to merge all menu items and show the full navigation on each page.
By separating menus into standalone views and including each and one of them into a navigation view, you can have a well-structured non-repeating code.
$this->renderPartial('anotherView');
is pretty much everything you might need to know to get started. This is only callable in views as $this refers to the current controller object.
You can use views from other controllers:
$this->renderPartial('application.views.student_Contact.show',array('model'=>$model));
Hope this helps.