Demo example

Hi,
is there any example in PHP to have multiple pages shown, to which I can each time press "Page down" to scroll to next page?
LVL 11
HuaMin ChenProblem resolverAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

weaverkCommented:
since your pages are already shown, and php is server side - its no longer involved

 you could take a look at anchor tags or some javascript plugins for this

example - http://davist11.github.io/jQuery-One-Page-Nav/
0
HuaMin ChenProblem resolverAuthor Commented:
Thanks.
How can I further show "Usage" and "Examples" (from your example), with different picture file?
0
weaverkCommented:
if you mean change background image, the easiest way is to use the css 'VH' property

example: http://codepen.io/anon/pen/ojNxbQ


please note this does not work in very old browsers (ie 8 etc)
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

HuaMin ChenProblem resolverAuthor Commented:
Many thanks.
The url now does retrieve file from DB. is there any similar example/demo, that is retrieving picture files from the OS instead?
0
Ray PaseurCommented:
PHP runs on the server.  Client information is displayed in the browser.  Because of this division of labor, it might make sense to organize this application in the form of a JavaScript call to a PHP API.  One of the popular modern tools for this is AngularJS, from Google.
https://angularjs.org/
0
HuaMin ChenProblem resolverAuthor Commented:
Yes, I want to display picture files (that are from the server), on the page. Any sample/demo to this?
0
Ray PaseurCommented:
In HTML we use the <img> tag to display images from the server on the client browser.  You can manipulate the Document Object Model with JavaScript.  This book will teach you all you need to know about JavaScript.  It is the only JS book I recommend.
http://www.barnesandnoble.com/p/javascript-david-flanagan/1103237657/2672114789478

JavaScript can be simplified (sometimes) by using jQuery.  All the docs for jQuery are online.

AngularJS (linked earlier) has extensive online documentation.
0
HuaMin ChenProblem resolverAuthor Commented:
Sorry to that, I expect to see one working example.
0
weaverkCommented:
HuaMinChen,

your 1st question "how do i use php for rendering client side things" - was answered, with example

your 2nd question - "how do i handle background images in CSS" - was answered, with example

your 3rd question - "how to use images on the server in my code" - i will answer now, either replace the url part of my example with '//yoursite.com/path/to/image/imageName.extension' or, with the relative path on the server e.g. ../img/imageName.extension, from what you are asking, its the second option you are looking for, please see explanation

your 4th question - "show me how to build a website with angularJS" - nobody can answer here, if you are curious there are good video tutorials on youtube, online learning courses at teamtreehouse.com, and plenty of other resources out there via google.

Cheers,
W.
0
HuaMin ChenProblem resolverAuthor Commented:
Hi,
I want to show this picture

/home/huamin/Downloads/emu_wild_animal_bird.jpg

on PHP codes. how?
0
weaverkCommented:
<img src="<?php echo '/home/huamin/Downloads/emu_wild_animal_bird.jpg'; ?>" alt="picture description here">

Open in new window

link
0
HuaMin ChenProblem resolverAuthor Commented:
Can I put such line into one PHP file? Any other details to the PHP file?
0
HuaMin ChenProblem resolverAuthor Commented:
Any advice to this error
[root@CentOS65x64 html]# php -f info3.php
PHP Parse error:  syntax error, unexpected '<' in /var/www/html/info3.php on line 2

due to this file?

<?php
<img src="<?php echo '/home/huamin/Downloads/emu_wild_animal_bird.jpg'; ?>" alt="picture description here">
?>
0
weaverkCommented:
you have double <?php....?> remove the outside ones


<?php
<img src="<?php echo '/home/huamin/Downloads/emu_wild_animal_bird.jpg'; ?>" alt="picture description here">

Open in new window

?>

reading matter
0
Ray PaseurCommented:
This question might be easier to answer if we shared a background of understanding in how the technologies work together.

PHP and MySQL run on the server; they generate the HTML, CSS, and JavaScript statements that are sent to the client.  This is called a "response" or "document" and it is sent in response to a "request" from a client machine.  The most familiar version of a "request" is a browser, where we type a URL to visit a web site.  This relationship is known as the HTTP Client/Server Protocol.

The image tag is part of the HTML sent to the client machine.  It contains a URL for the image.  This URL is resolved through rules related to the directory structure on the client machine.  It is unlikely that the URL of the image would include working directory paths known only to the web server.  My guess is that this URL would be correct (but it is only a guess because I do not have access to your server to make a test).
<img src="<?php echo 'Downloads/emu_wild_animal_bird.jpg'; ?>" alt="picture description here">

Open in new window

If you're new to these web development technologies and want to learn them, SitePoint has a great collection of materials - books, online forums, articles, etc.  There are others, of course, but in my experience, SitePoint is pretty good.  If you already know HTML, CSS and JavaScript, and just want to learn PHP, this article can help you find dependable learning resources.  But if you don't already know HTML, CSS and JavaScript, I would recommend studying those technologies in that order before tackling the server-side programming.
0
HuaMin ChenProblem resolverAuthor Commented:
Sorry, I get nothing shown, by this

[root@CentOS65x64 html]# php -f info3.php
<img src="/home/huamin/Downloads/emu_wild_animal_bird.jpg" alt="picture description here">

[root@CentOS65x64 html]#
0
HuaMin ChenProblem resolverAuthor Commented:
After I've removed the outer one

<?php....?>

to the file.
0
weaverkCommented:
... you cannot display a picture, or render html in your console (the black window)!

from the code you linked, the 1st line is your php console command, the 2nd line is the html code code returned (not 'nothing shown')

you need to open this file in your browser.... http://serverurl/path/to/file.php

and you really REALLY need to read a good guide starting from the absolute basics

Good luck...

Cheers,
W.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HuaMin ChenProblem resolverAuthor Commented:
Many thanks. How can I now refer to the specific PHP file, from the browser?
0
HuaMin ChenProblem resolverAuthor Commented:
What URL should I use now, to open it within Browser?
0
HuaMin ChenProblem resolverAuthor Commented:
On my current machine.
0
weaverkCommented:
The original question (and several others) have been answered here, i suggest you ask separate questions for further problems.

The most likely solution would be to access http://localhost/yourfilename.php IF your file is in the root of your server - but only you know this... for more details find a tutorial on setting up LAMP (Linux, Apache, MySQL, PHP) stack, to understand better where your files are
0
HuaMin ChenProblem resolverAuthor Commented:
I copy the .php file to /root, but then I've got this

7
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.