views_embed_view('FeaturedSalesProperties','default') - php

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...

Related

Laravel view more link pass id

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.

Wordpress & Learndash - Course Redirection Filter via PHP code

I'm very new to PHP programming, and I'm completely stumped by what is likely a very easy piece of code.
I have built a website using Wordpress and Learndash LMS to sell online courses. One of the courses has two quizzes; One in the middle of the course, and one at the end of the course.
Due to the limitations of Learndash, I am not able to add the quiz after a lesson. Or if I do, there is a "Mark Complete" button that essentially would allow a student to skip the quiz, which I do not want them to do.
The solution I found was a php filter provided by Learndash:
add_filter("learndash_completion_redirect", function($link, $post_id) {
//You can change the link here
//$post_id is ID of the lesson/quiz from where the user is being redirected from. $link is the link to which the user is redirected from.
return $link;
}, 5, 2);
However, I have no idea how to make this filter work.
Where do I put the links, but also what do I write as code to make it work?
For example, when a student completes Lesson 10 on the course and the link is "http://course.com/lesson10", I want this filter to take the student to Quiz 1 "http://course.com/quiz1"
Again I'm very new to PHP programming, so if I haven't been completely clear on my explanation I apologize and will add any additional information if needed.
Assistance would be greatly appreciated, thank you.
This add_filter goes into the functions.php file in your active theme directory.
Your code should determine from the post_id where you are and where you want to go to and return the new pade URL in $link.

Wordpress post customising

i was wondering if this is feasible.
Supposing my i want to divide my post ... Lets say, i have all my post side by side in 2 rows.
Lets say a total of 8 from the category (Mypost)
Now assuming, i want to have a static between the first 2 rows and the rest of the columns below, is this feasible?
Also assuming i want latest post to show on the 2 up rows and the old post to move below my div.
I have tried , but did not come out with any feasible solution.
Great if someone could be able to assist. I have content.php where all my contents are being generated and index.php being the front end.
Thank you
using two WP query may help you ,use this one for latest post
<?php query_posts('category_name=Mypost&showposts=5');?>
And for the older posts use
<?php query_posts('category_name=Mypost&offset=5');?>
I really don't understand your problem clearly,hope this is what you want
THANK YOU Akhila - Ok, i needed to edit the code a little bit - This code works!:)
<?php query_posts('category_name=post&showposts=2'); ?>
<?php query_posts('category_name=post&showposts=100&offset=2'); ?>

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.

Adding new Tables in an Open Source Script (Beginner Question)

I'm still a new php beginner, in fact I just started learning couple a days ago.
I love to learn and implement at the same time on real scripts because that's motivate me to continue learning.
Yesterday I put my hands on an open source script (File Uploading Script)
And the script is pretty simple, and I want to create categories in the script
Example: When someone would like to upload he can choose the categorie of the file so it can be added there. I should create the values of the categorie (either in MYSQL or from Control panel)
What I want: I want you guys to tell me what exactly I should be doing. for example U should create something and something to do this. and that's all.(no accurate steps)
I know how to deal with mysqls and with php but I would like to get hints of what every programmer will should do that is all.
[DB Part]
You'll need to create a table contains 2 or 3 fields:
catID field (would be a primary key & autoincrement)
catName field (contains tha category name)
you can add a parentID (to have the catID of the parent category if there is any), imho, no real need for it as a beginner
you will need to link this table with files table taking catID as the foriegn key
[Form Part]
You can either list the categories in the uploading form, to be in a combo box, dropdown list, or even a check box, then insert it in the DB within the form,
or you can let the you user chose the category first before you show him the uploading form, then in your script you register the the catID in a session, & later when you upload the file you use that catID value
see?

Categories