Peter Chan
asked on
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?
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?
ASKER
Thanks.
How can I further show "Usage" and "Examples" (from your example), with different picture file?
How can I further show "Usage" and "Examples" (from your example), with different picture file?
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)
example: http://codepen.io/anon/pen
please note this does not work in very old browsers (ie 8 etc)
ASKER
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?
The url now does retrieve file from DB. is there any similar example/demo, that is retrieving picture files from the OS instead?
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/
https://angularjs.org/
ASKER
Yes, I want to display picture files (that are from the server), on the page. Any sample/demo to this?
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.
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.
ASKER
Sorry to that, I expect to see one working example.
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/im age/imageN ame.extens ion' 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.
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/im
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.
ASKER
Hi,
I want to show this picture
/home/huamin/Downloads/emu _wild_anim al_bird.jp g
on PHP codes. how?
I want to show this picture
/home/huamin/Downloads/emu
on PHP codes. how?
<img src="<?php echo '/home/huamin/Downloads/emu_wild_animal_bird.jpg'; ?>" alt="picture description here">
link
ASKER
Can I put such line into one PHP file? Any other details to the PHP file?
ASKER
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/em u_wild_ani mal_bird.j pg'; ?>" alt="picture description here">
?>
[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/em
?>
you have double <?php....?> remove the outside ones
<?php
reading matter
<?php
<img src="<?php echo '/home/huamin/Downloads/emu_wild_animal_bird.jpg'; ?>" alt="picture description here">
?>reading matter
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).
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">
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.
ASKER
Sorry, I get nothing shown, by this
[root@CentOS65x64 html]# php -f info3.php
<img src="/home/huamin/Download s/emu_wild _animal_bi rd.jpg" alt="picture description here">
[root@CentOS65x64 html]#
[root@CentOS65x64 html]# php -f info3.php
<img src="/home/huamin/Download
[root@CentOS65x64 html]#
ASKER
After I've removed the outer one
<?php....?>
to the file.
<?php....?>
to the file.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Many thanks. How can I now refer to the specific PHP file, from the browser?
ASKER
What URL should I use now, to open it within Browser?
ASKER
On my current machine.
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
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
you could take a look at anchor tags or some javascript plugins for this
example - http://davist11.github.io/