Pull list of content-type for display - drupal-7

New to Drupal, using 7.65 & can't update.
I've created a custom content type. I need to pull these through to the homepage and the loop through each to setup the formatting and display them on screen.
I thought this would be done with pager_query, but that's breaking the page. How do I pull the results to then loop?

Related

Pull data into filter or new field

I need to keep updating a filter by adding landing page URLs to it - but those URLs already exist in Google Sheets (and are updated there first).
Is there a way to make the filter pull directly from the sheet?
Thanks,
Steve
How about using the sheet as a halfway house for your main data source, and using formulas to filter the data there before it even reaches GDS?

React router - different content if post in list vs own page

React router has very cool feature: if you have a list of items (Instagram for example) and if you click on one item, content opens in modal/overlay but if you copy-paste the link to new tab/window or share the link with a friend for example, it opens in its own page.
I would love to use this feature but I need to find a custom solution..
My posts are very data heavy
I've split posts data into 2 tables in database
1st is very lightweight containing essential data: 4-5 columns
2nd table is very heave, ~30 columns
When user uses search filter, list updates only with data from 1st table
If user clicks on post, it will open in a modal/overlay
I will recycle the data I already have (from 1st table) and also get rest of the data from 2nd table
However, when user shares the link or opens it in new tab/page, data from 1st table is not present. I would need to integrate a conditional logic:
If post opens in list view (modal/overlay), only get additinal 2nd table data
If it's opened in a new tab/window in its own page, get all the data, 1st table included
How could I integrate this with React router? Has anyone already tried it? This would also allow to use different layout/components when user opens item in page view. Is there a way to check it?
Or is there a flaw in my logic? I imagine list would update very fast because it doesn't require huge amount of data and also would modal/overlay because it recycles some of the data.
I read all the docs, also searched online - didn't find anything.
Modals in react router are great. I've used the pinterest example and adapted it to my own needs.
Ensure you do your check on state.modal===true in a master layout component to give you the modal styling.
you'll need to check if table 1 stuff is present in your state and dispatch an action to trigger the async call in componentDidMount. You should be fetching table 2 in all scenarios.

Changing states without reloading previous view data when I go back to it

I am new to angular and was wondering if I could somehow change states (after clicking on link from a list of search results) and load a new view, hide the old one (including header !), but not unload it/not have to request JSON data again if I got back to the search results for products view from the product details view.
Well, this will be a really short answer.
Take a look at this:
$templateCache You can play around with it so you won't need to reload pages when going back and forth.

Cakephp: iterate through pages in a custom view

I have a view with several megabytes of data and I expect it to grow radically.
Controller index function is implemented in a default way, with pagination.
I would like to export this view to a csv without making much changes to the controller ( I'm fine to define header rows and rows to be included in a CSV but not to remove pagination as it brakes the html representation ).
The idea is simple: render csv view template, change the page, render another one. But how can I change current pagination settings in a custom view?
PS: I did take a look at the csv plugin. It doesn't work with pagination so I get out of the memory limits, it also creates a tmp file, I prefer to stream content on the fly.
I wouldn't use the paginator here, just get the total amount of records then do a while() loop and fetch the data in batches to avoid memory limitations. And send it as it comes from the DB directly to the client. Use the HTTP Client that comes with CakePHP and set the proper header properties.
See these two answers how to send it as stream:
send a file to client
PHP: stream remote pdf to client browser
Streaming a large file using PHP

Pyrocms Getting Values at front end

I am new to pyrocms.
How can I get database values on pages of pyrocms. In website of pyrocms I had created a listing page now I want to display database values from pyro database table.
I got your question, you want to create a listing on your front-end page for some database table values which you want to access through your custom module controller. there are many ways to get these values but the simplest way is to use ajax. you already have Jquery added in pyrocms so you can simply make a call to your controller method in ajax and get your required output as HTML and display it in the div element on your page.
$.ajax({
type:"POST",
url:"admin/your-controller-name/your-method-name",
success:function(html){
$('yourdiv').html(html);
}
})
In your controller create a method which get data from database and print it using echo create some listing table etc what you want.
i think you will get my point. if confuse then get back to me
You need to be more specific as PyroCMS has lots of components and each module (blogs, variables, widgets, file uploads etc.) uses specific tags you insert into the page. You may come across references to 'Lex' - that's the name of the parser used to display them.
Tags documentation
PyroCMS (the Professional edition) also has a feature called "Streams" which allows you to build custom databases and this in turn has it's own series of tags.

Resources