To add comments or start new threads please go to the full version of: Web Design
PhysForum Science, Physics and Technology Discussion Forums > Technology > Technology

santhakumar
How do create a site which changes to suite all screen resolutions?
flyingbuttressman
QUOTE (santhakumar+Jul 5 2012, 06:30 AM)
How do create a site which changes to suite all screen resolutions?

I believe the term you are looking for is "responsive web design"

A Google search on that should find you plenty of material.
jaykumar
When your crating a website you have to create it using correct resolution 800X400 is the largely used resolution on website will suit all screens and the elements must be designed in a better way.

[Moderator: No spam please]
angelinwilliams
QUOTE (santhakumar+Jul 5 2012, 10:30 AM)
How do create a site which changes to suite all screen resolutions?

Hi,

Adjusting a website to fit all types of resolution can be done by

simply using the concept of relative width of a web page. The

relative width of a webpage changes with the screen resolution of the

computer screen which is used to view the web page.



Confused1
I've got lots of text (HTML) that I now need to switch in or out from php
(simplified) example:-

<tr>
<td>
With it's ground-breaking Adaptive Frequency Hopping blah blah..
</td>
</tr>

I'm sure this can be done without rewriting the whole lot as
{
print "<td>";
..
}

the problem seems to vague to find by google..
can anyone help?
-C2.







flyingbuttressman
I usually write my HTML as a normally would, and then insert PHP code inline.

<tr>
<td>< ?php print $variable; ? ></td>
</tr>

(remove spaces between < and ?)
Confused1
Thanks FBM. The problem is the other way round: I need to embed large chunks of HTML within php .. so I can switch out a long description of an item (in HTML) without rewriting the HTML (now many pages)

IF ( $stock >0 )
{
start_of_literal->

recycled old HTML description with links etc

<-end_of_literal
}

I've seen the thing but I can't remember where or what it was.

Thanks again,

-C2.

If ( $stock=0) .. is fun (hours wasted) .. ( $stock==0)




flyingbuttressman
Yeah, there's no problem with throwing < ?php and ? > wherever you want, even inside conditionals.
Confused1
I think I have it:
It's a heredoc or possibly a nowdoc I need.
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;
Thanks,
-C2.
flyingbuttressman
QUOTE (Confused1+Aug 2 2012, 09:56 AM)
I think I have it:
It's a heredoc or possibly a nowdoc I need.
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.

Oh, so you were trying to embed all that in a string? At that point I would probably put that html in a template file and pull it in with file_get_contents()
Confused1
Thanks FBM, this does what I need:
< ? php
$instock = 1;
If ($instock > 0)
{
echo <<<EOT
This block of old HTML <br>
With links and pictures of bananas<br>
switched on <br>
by stock level > 0<br>
We have $instock bananas smile.gif <br>
EOT;
}
else
{
echo <<<EOT
And this new block of HTML <br>
switched on <br>
by stock level = 0 <br>
We have $instock bananas today sad.gif <br>
EOT;
}
? >
flyingbuttressman
< ?php if($instock > 0): ? >
Some HTML about Bananas<br />
We have < ?php print $instock; ? > bananas
< ?php else: ? >
Some more html<br />
We have no bananas today
< ?php endif; ? >
Confused1
@FBM,
Much better than my solution - many thanks.
-C2.
flyingbuttressman
QUOTE (Confused1+Aug 2 2012, 02:39 PM)
@FBM,
Much better than my solution - many thanks.
-C2.

No problem. Are you just getting started with PHP?
Confused1
This is my third website using PHP (since 2005). Mostly I'm just reusing chunks of code from earlier efforts so I'm getting worse and lazier instead of better. Most of my site is live from the stock database so it kind'a writes itself. The bit of code you provided will be used to switch on/off some of the fancier bits where I've provided pictures and details about the product. Thanks again, -C2.
Guest
Using "div" blocks, you can make your Web pages resize smoothly when site visitors resize their browser. Web developers refer to flexible Web page layouts as liquid layouts. Many pages on the Internet consist of columns laid out in tabular format. For instance, a navigation bar may appear on the left and the main content in the middle. An optional third column on the right may hold advertising or other information. Learning to use "div" blocks will help you design and create liquid pages that adjust to suit the needs of your site visitors.
PhysOrg scientific forums are totally dedicated to science, physics, and technology. Besides topical forums such as nanotechnology, quantum physics, silicon and III-V technology, applied physics, materials, space and others, you can also join our news and publications discussions. We also provide an off-topic forum category. If you need specific help on a scientific problem or have a question related to physics or technology, visit the PhysOrg Forums. Here you’ll find experts from various fields online every day.
To quit out of "lo-fi" mode and return to the regular forums, please click here.