iGuest 3 Report post Posted January 19, 2005 Hi,2 things,1) I"m looking for anice begginers tut for php... please.2) How to insert an html tag in to php file? something like <br>, and so on...Thanks, and sorry for my english... :S Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 19, 2005 to insert html into it either do<? php here?>html here - between the close tags of php<?php here?>or<?print 'html here';?>and check out the tutorial section... Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 19, 2005 Yeah you can just exit and enter PHP mode in a PHP file as many times as you want! To enter PHP mode type <?php to exit PHP mode type ?> All PHP coding goes between the two php tags like so: <?php echo "hello world"!; ?> Also to instert html tags into php just do sommit like: <?php echo "<a href="https://www.google.de/?gfe_rd=cr&ei=7AkjVIatDsKH8QfNkoC4DQ&gws_rd=ssl">Google!</a>"; ?> If you have any double quotes withing double quotes as shown above you'll need to escape the double quotes by using a in front of the double quotes. Here are some additional links for PHP http://php.net/ http://www.w3schools.com/ https://www.sitepoint.com/ http://www.phpfreaks.com/ Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 19, 2005 wildteen88, great links, thanks Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 19, 2005 TNX!!! Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 19, 2005 <?php echo "<a href="https://www.google.de/?gfe_rd=cr&ei=7AkjVIatDsKH8QfNkoC4DQ&gws_rd=ssl">Google!</a>"; ?> If you have any double quotes withing double quotes as shown above you'll need to escape the double quotes by using a in front of the double quotes. or you can just put them in single quotes. <?php echo '<a href="https://www.google.de/?gfe_rd=cr&ei=7AkjVIatDsKH8QfNkoC4DQ&gws_rd=ssl">Google!</a>'; ?> if you want to put php variables in the middle of a print line then you can in any of these ways... <?php echo '<br />'.$a.'<br />'; echo "<br />".$a."<br />"; echo '<br />$a<br />'; ?> Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 19, 2005 Hey guys, try to use the code tags. It makes everything easier to read. Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 21, 2005 <?php echo '<br />'.$a.'<br />';?> This will be the fastest way, because PHP won't be searching for variables and escape characters as it would be if double quotes are usedI'm using double quotes to output only escape characters(like "n") Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 21, 2005 There no real difference between a single or a double quote! I always use double quotes and escape double qyoutes with in double quotes! I'm not lazzy! Also with doubles you don't need do what you do above as you can just do <?php echo "<br />$a<br />";?> Well poeple have different methods of using PHP! lol! Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 21, 2005 There is a difference between single and double quotes. Strings inside single quotes are not run through for escaped characters or variables-they are simply printed. Strings inside double quotes are. As a result, the parsing of single-quoted strings is much faster than the parsing of double-quoted strings, especially if the string contains a bunch of variables and/or escaped characters. In a small script, the difference is not noticable. However, if you are designing a large application, then you should ALWAYS use single quotes for a string that does not contain an escaped character or a variable. It may also be worth it to use single quotes for everything but escaped characters, and put variables outside the quotes, like in karliks example above. Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 23, 2005 I heard And read something about the tag or function <?phpHTML_BLOCK>>here the HTML.<<END_HTML?>But how does this works exactly.. :oops: Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 23, 2005 hmm i dont know about that specific way - id be interested to know though.i use html inside php in a similar way for my form templates.<?$varname <<<HTMLhtml hereHTML;?><?print $varname;?> Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 24, 2005 you can put html in echo butwith " you have to put echo" <img src="http://forums.xisto.com/no_longer_exists/404.png" width="10">";and with ' you can use echo" <img src='http://forums.xisto.com/no_longer_exists/404.png' width='10'>";you like ' or " ?! Share this post Link to post Share on other sites