Laravel view more link pass id - php

Hello I am using laravel 5 to display a 20 column csv from my database, I have a foreach loop displaying 5 of the 20 columns in a table and then a view more button to take you to another page with a table showing all the information of that particular row depending on the id.
My question is how do I pass the id to the other page so I can do another foreach loop to display the rest of the info? I have it so when you hover over the link it's display the id. I know this is vague so if you could point me in the right direction it would be much appreciated as I'm not home at the minute so I can't post my code, thanks!

What you are looking for is called pagination and lucky for you Laravel has made a beautiful function to make this easier documented at https://laravel.com/docs/5.4/pagination.

Related

How to link/navigate through SQL search results in PHP one page at a time

I am building an admin type script to view records within a mySQL database. This links in numerous tables and is all working perfect. I have now added a filter form to allow me to search/filter for records that match specific criteria. Again this works perfect.
The problem I cannot get my head around is this...
For each record I have a link that allows me to go into that record and view more information/perform tasks on the record.
Initially it was simple to have a 'Previous' and 'Next' link for cycling through the records which meant I didnt need to go Back to the search results to go to the previous/next record. It simply +1 or -1 from the current record ID to generate the link.
Now however I am filtering so the records ID's might be 1,3,4,5,8,10,15,30 etc
The problem is now that once I click into any one of the results to view that record I essentially lose the filtering and all of the results.
The only way I can think of achieving this is to pass the filter variables in with the link and redo the filtering every time the View page is loaded, working out where the current record is in the result set and creating a link based on the previous and next records in the result set.
Am I doing this correct or is there a better way?
I have searched but most answers are geared towards the basics of looping through mySQL query results which sounds the same but is very different.
Any advice would be greatlt appreciated!

codeigniter search box and keeping data

I want to keep page in search form and when I visit another page and return to previous to see only what I search.
For example, I have page with table, in that table I have list of all products which is 30 products. When I submit search query for some word and get per instance 5 products, I want to keep that and visit all another pages and when I back on product page to see again only that 5 products.
Any help?
You're looking for a way to store dynamic data. Your best bet would be to use something like Sessions or LocalStorage

Catalog View with pagination (Codeigniter)

I need to build a catalog with posts that I get with a query, each page of the catalog will have 27 spots for posts (except for the last page). The problem is that some posts need two spots if there was an image attached when the post was created. I don't have a field in the database that tells me if the post have an image or not, I would add it if is necessary. So far I have this two possible solutions:
1) Get the 27 results and then loop trough them to see how many posts have images and then calculate an offset of the posts that where not displayed so the other page would start with the correct number.
2) Add a field in the database for tracking if a post has an image attached and then run a query with a conditional so I get only the posts I need to get the 27 spots filled.
The problem that I'm having is on how to keep track of these offsets. What happens if the user wants to go to the last page? Do I need to query all the posts and then calculate the offset for that last page?
I'm hoping I'm making some sense, sorry for my english too, I'm not a native english speaker.
Thanks in advance.
You can join both the tables if results are correct and convinent as expected by you and secondly in codeigniter you don't have to worry about the pagination stuff for last and first, the pagination library takes cares for that. For more details on pagination library, visit the below link:
http://ellislab.com/codeigniter/user-guide/libraries/pagination.html

Display column-based instead of Row-Based records in PHPMaker 10

I'm having trouble and I wanna ask, if it's possible to have column-based tables when PHPMaker generates tables for records? Because when I generate it only generates row-based records. Copy-paste the link below to URL to understand. I'm sorry I'm not knowledgeable in PHP that much. It's just very easy to make a complete application with this program and the only thing stopping me is the format of how it's shown. An example of how I wanted it to look like would be this one
I hope somebody answers! Thanking you all in advance!
That kind of column based view is not suggested as it has many flaws when we try to display huge number of records. Adding pagination or sorting feature is very difficult and not user friendly.
As you have so many fields you could try to group them into tabs by relevancy. Once you put them under different tabs they can be easily navigated and easily fit into row based structure.
Creating tabs is PHPMaker is very easy, on field configurations screen you will get Page No config next to each field. By default it set to 1 you can set required page number as per your choice. Once you done go to Table config of the table which is second tab available for each table. Scroll down to bottom and and click on 3 dots next to Page Labels config (Under Multi Page Config). This will pop up a screen where you can add captions for your tab.

views_embed_view('FeaturedSalesProperties','default')

I am new in drupal. and I have this piece of code:
<?php print views_embed_view('FeaturedSalesProperties','default');?>
in page-node-3167.tpl.php
it prints on site 3 random featured ads... and I do not understand what SELECT in DB is executed...
I found record in views_view with name FeaturedSalesProperties and base_table node but still do not know how this 3 ads are chosen...
Also it looks like the drupal site is modified because if i wanna access site/admin there is no drupal administration...
Can anybody explain me how can I modify this view so it will print not 3 random featured ads but all of them?
Thanks
Ok, so I found a way how to edit it without drupal administer... all values are in DB...
at first find your view in view_view table
second find in view_display record with the same vid as your view...
look into field display_options and that it is...
It is quite complicated to find which value to change but it is possible :D also it is helpful if you can create some view in other drupal system and watch what has been changed if you turn this option or this...

Categories