Aptana Studio 3 combine php with html - php

hi guys am having problems mixing P.H.P code into an HTML file i get error on P.H.P that says missing end tags any help please

I think, you are missing something, either you are not saving the file with ".php" extension.
And also there were some errors in your code. you was putting semicolon at the end of HTML tag. whci is not practiced.
Following is the code which is running successfully.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "w3.org/TR/html4/loose.dtd">
<html xmlns="w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>New Web Project</title>
</head>
<body>
<h1>New Web Project Page</h1>
<?php echo "string"; ?>
</body>
</html>

Related

how to save image from a dive and save it into a server directory with php and ajax

i want to say an image from a div and i want to save it ito a server directory with ajax call (without page refresh). LIke the following code.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<div class="test">
<img src="one.jpg" />
</div>
</body>
</html>
Now i want to save it into a server folder with ajax call but i don't have any idea how i can do this, kindly guide me. Thanks in advance.

Mail template encoding suddenly wrong. Only rewrite manually works it seems. Some tips, knowledge?

I have a problem with our E-Mail templates.
They worked fine until 2-3 days ago i have no idea what happened.
They should be utf8 encoded and get shown correctly in PHP Storm they look something like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
....
}
</style
</head>
<body>
<center>Content with unique characters like ěäüß</center>
</body>
</html>
But in the Email the output is completely rubbish:
Vaše zakázka etc.
I use the output buffer to get the template content and send it with PHPMailer.
There is no encoding anywhere but shouldn't be needed.
I tried utf8-encode/decode etc. It makes everything only worse.
The only thing that worked is to use tools like this http://www.percederberg.net/tools/text_converter.html
to convert the plain text into utf-8 and then the code looks like rubbish like in the mail output, but then you can manually correct every character.. that worked for some templates like in german with some äüß.... but in the Czech template you have to rewrite every single character.
Is there something that i missed? Something that i could try?
I used htmlentities() on the text parts of the templates and worked quite decent!
Example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
....
}
</style
</head>
<body>
<center><?php echo htmlentities("Content with unique characters like ěäüß"); ?></center>
</body>
Hope this helps someone!

How I can write a html code (templete) to a html file by php? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
How I can write html code (not executable) to a file by using php filesystems. For example I want to put my html page template which includes DOCTYPE, HEADER, BODY BLOCK, FOOTER etc.
as i got you question
save file index.php instead off index.html.
inside you can use
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
</body>
</html>
when ever you need to write a php(inside body)
use
<?php
//php code goes here
?>
example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php
//php code goes here
?>
</body>
</html>
php will work when file extension is .php. if file extension is .html browser will not recognize your PHP code and it shows complete code on browser
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>
Your first PHP-enabled page
Read more

Form opens in new iframe

I've got a problem. I have got two servers on first I've got my whole db with login page, and on secoud one I've got my WWW page. Those servers are on diferent domains. I build site, where is 2 iframes, each iframe respectively from first and secoud server. When I submit form the results are opening in new tab instead of place results in the secound one. Belowe is code. I will add only that, on IE it works good.
secound server
index.html (this is the main frame)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>New Web Project</title>
</head>
<body>
<iframe name="vforms1" src="vforms.php" width="200" height="200"></iframe>
<iframe name="map1" src="http://xxx.xxx.xxx/map.php" width="200" height="200"></iframe>
</body>
</html>
vforms.php
<?php
if (isset($_POST["variable"])){
$var2 = $_POST["variable"];
echo $var2;
}
else echo 'waiting';
?>
first server
map.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test page</title>
</head>
<body>
<form action="http://xxx.xxx.xxx/test/vforms.php" method="POST" target="vforms1">
<input type="hidden" name="variable" value="send"/>
<input type="submit" />
</form>
</body>
</html>
I am working on that since last friday, and try to do everything! Now it's realy drive me crazy! Can anybody help me?
Cheers!
Because it is on a different domain, there are cross domain policies in place. The <form> does not know about the other iFrame, and cannot access it. Neither can it access it's parent.
So, there really is no option on how to fix it, other than remotely connecting to the database with php, and removing the iFrames all together (which is a bad thing in the first place)
Are you sure you should be using the frameset doctype inside a framed document? You may be rendering the target attribute invalid.

Hindi Fonts not Displaying at bRowser

I am Copying Hindi Words From Google Translator and Pasting it in my php page. In editor It is Correctly displaying But at Browser it is showing "???/" Marks. I have included charset"utf-8" in header also.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="hi">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<span>मैं एक अच्छा प्रोग्रामर हूँ</span>
</body>
</html>
Copy this and Save this in one html file..and try to run..it'll work..

Categories