Printing web pages in an order - php

I've a php file which'll run a SQL script and fetch information about users.
Some user's information may span 2 or 3 pages while some might end in just 1.
I want to print the beginning of ever user's report in a new page. All these process has to be automated because there are some 400 users, and the client can't select page layout for every user or print them individually.
How can i achieve this? using PHP or Javascript?
Is there any library to do this?
Thanks :)

Your question was a little confusing, but now I think you're talking about doing page breaks in a print.css? If so you can use: page-break-before and page-break-after in your CSS.
So using CSS you would do something like:
div.pagecontainer { page-break-after:always; }
Where your page was contained in:
<div class="pagecontainer">page content here</div>
If you're just trying to figure out pagination. Take a look at this php solution.
You can also do completely client side pagination as mentioned in this question and this question.

Related

I want to create certain number of html pages dynamically with different content some similar content same layou using php, .net or any other method

can anyone help me in this situation dat
i want to create around 1000 html pages with same layout and different content and some similar content like header, footer, menu and a paragraph in body with some changing values like page title , meta tag , name of file, breacrumb etc should be taken from database .
As far as understand your problem you want to create 1000 pages with same layout but different cases.
I have done this earlier.If you can handle the tons of code in single file the you don't have to create 1000 pages. Only One single page is enough.
You can follow the concept of Query Strings.
Assign links in your page as
<a href='services.php?id=services'>Services</a>
<a href='services.php?id=mail'>Mail</a>
and handle it like this
<?php
if(isset($_GET['id']))
{
if($_GET['id']=='services')
{
//display the content of services
}
else if($_GET['id']=='mail')
{
//display contents of mail
}
}
?>
First You decide the layout. Then Where The content should be changed use this code. All other layout will be unaffected only the code inside if condition changed.
There are many web development frameworks that would support what you are looking for. Based on what you described, you could achieve it without any programming by using a content management system like Wordpress. Or if you are interested in building your own, then you could start with ASP.NET, Ruby on Rails, or PHP.
It sounds like you are looking for a content management system (CMS). Usually you will define a master page template and dynamically generate the other pages from data.
The following site gives a good overview of features sorted by technology:
http://www.cmsmatrix.org/

Database+Tooltip like wowhead

I´m searching a solution for this:
I want to have a series of pages where the information is provided on a single page like you see it here: http://www.wowhead.com/quest=12141
I want to have the information, which is on the page I've made, in a tooltip. Wowhead does it like this: http://www.wowhead.com/tooltips
I've tried the following:
I've made a MySQL database with my information in it and I'm able to print them out on the site.
Here is my problem. How do I get the informations inside of a tooltip. I can print them out with "php echo", but this would be a bit too complicated for general users to click on and wait for a page load to see them.
Summary: I need an easy solution to print out the information on a web site inside of a tooltip.
I hope you have any tips for me...
You can print all the content at once and show the tooltips using js without ajax requests.
I might misunderstood you and if yes - you should take some ajax tutorial

Loading another html document within a div?- Advice?

I'm building a site where there will be four tiles on the front page. When a tile is selected, I want the content to pop up in like a window that will be a bit transparent so you can see the main page behind it.
I've successfully coded just that, getting the link to bring up another div that is otherwise hidden and I've even gotten it to load another html document. I accomplished this with XMLHttpRequest();. My question is, is there a more efficient way to do this? I know I've done something similar in PHP before in school and when I google, I do see that being a way to do it, but I'm also seeing jQuery and AJAX being mentioned. My overall goal is to get it to where if I want to update the CSS of the screens, that I only have to do that for the main page, and it affects the content pop-ups.
I hope I explained this well enough. Thank you for any advice!
It's very simple to do in jQuery:
$("#yourDivsId").load("/UrlOfYourIntendedMarkupDelivery?anyarguments=true");

slideshow banner without using flash

I want to make a sort of repeating slideshow banner for my website, but i need some help on how to do it. The best example of what i want is on the play.com website, they have a banner that has 5 different slides, the site scrolls between them after X amount of time but the user can also click on one of the numbered buttons at the bottom of the banner to skip.
I'm thinking of doing this using HTML, CSS, JavaScript, AJAX and PHP. I have an Ajax script set up already linking to a php page that will at somepoint check through a database to get its content. But i want to output everything using lists lu and li.
So does anyone know of any tutorials or something i could use to get something like on play.com? play.com is more or less and exact match to what i want.
Thanks for the help.
You can use jQuery in combination with slideshow plugins. You don't have to do much by yourself. A plugin which does what you want can be found here:
http://slidesjs.com
You can also search Google for "jquery slideshow". This should return lots of pages with plugins.
I use http://jquery.malsup.com/cycle/ as it has a very basic fade but also lots of different animations if needed.
Unless you have a good reason for it, there's no need for you to create the slider yourself, there are tons of options already made (and tested).
I often use this two:
http://nivo.dev7studios.com/demos/
http://jquerytools.org/demos/scrollable/index.html
here is a really simple one that loops through any number of <img> elements placed inside a <div class="slideshow"> wrapper and it only uses a few lines of jQuery and css...
http://jsfiddle.net/DaveAlger/eNxuJ/1/
hope this helps someone else

Including a file based on clicked link

I am beginning to develop a website as a personal project, to discover a little bit web technologies. My question is more about "how to make the things clean" than a technical question.
Here is the thing:
Let's say that an index.php page will include an other menu.php, which will permit to navigate the website.
My index.php look like this, basically:
include("header");
include("menu");
include("DEPENDING ON WHICH LINK AS BEEN CLICKED FROM THE MENU");
include("bottom");
To avoid the POST method, and have a lot of stuff on my URL, I would like to do it an other way, but I do not know what is the best one.
I thought about declaring a variable like $page, when a link is clicked, I can do something like "if $page == home", then I include the home.php page... etc...
I do not know if my question is clear... I know that it will appear as a very easy and beginner question but I don't even know where to look...
Do you know if I can find any "open source website" so I can study the code and see the best practices about it?
P.S.: Sorry for my english which is probably not perfect at all, I am working on it.
You can have a menu like
Home
About
Then on your PHP code
include $_GET["view"] . ".php";
Note that I am not validating, so any parameter passed on the url would be able to include any file.
The $_GET returns the values passed to the page through the URL.
The $_POST returns values posted.
The $_REQUEST returns both $_GET and $_POST values.
A good place to study many languages is W3Schools, you could check there sometime.
Make a page which will be common redirect page.
Every post will come to that page and based on the page parameter it will redirect.
So action of every page is same, but based on page paramter redirect to which ever page you want
You can switch case and
use header to redirect
i think you want to avoid GET method and avoid lot stuff in url
For learning
I thinks this is the simple website for learner.
http://www.w3schools.com/php/default.asp
http://www.plus2net.com/php_tutorial/site_map.php
http://www.tizag.com/phpT/
actually most of all these websites are same.
i hope you know the basic website PHP.net
Then,,.. no one is low level ..every low level will be in a top level one day.. just like you am also trying :)
Don't do what you are trying to do. The whole point of having pages is to handle things with different files. That is, you will have some commonality between files (handled by auto prepend and include path, potentially) such as your header and footer. Each file should include this on its own and print it out directly.
That is, you should not handle everything on one page and then conditionally include a file. Just send users to a different page.
Finally, I recommend not splitting up the header/footer files at all. Instead create a decorator that wraps the main content and displays it all at once. Something like:
$page = <<<HTML
<html><head><title></title></head>
<body>
<div id="top nav"></div>
{CONTENT}
</body>
</html>
HTML;
Then you go through and build your page content. Then you add it to CONTENT in the decorator and print it. PHPTAL is a great way to have this handled externally.
Hi you should please ask one question at a time:
I think this basic tutorial will give you a good idea on how and what to use the include(); func.
http://www.w3schools.com/php/php_includes.asp
I started with:
http://www.solitude.dk/filethingie/
Very simple .php file administrator.
You should definetly check out sourceforge, giant colletion of open source projects just filter by php (search for literally anything).
Just wanted to mention that you can download the full code of more complex pages (that are based on php) like
wordpress (blogging platform) - very easy to install and configure
identi.ca (twitter open source alternave)
You can now download reddit´s source code - quite easy to.
Maybe you wont be able to modify them immeditelly but theyll help you to get the picture

Categories