• Web Dev Questions That Don't Need Their Own Thread v4
    5,001 replies, posted
[QUOTE=Cyberuben;46156553]All HTML within your <?php and ?> must be echo'd. as following: [code] <?php echo "<html>"; echo "<body>"; echo "<p style=\"myClass\">Hello world!</p>"; echo "</body>"; echo "</html>"; ?> [/code] So to answer your question, yes, every line within your <?php ?> block contains about one error.[/QUOTE] Ahh yep. I've left it mostly straight HTML tags and just PHP tagged the small blocks of PHP. Thanks.
[QUOTE=Cyberuben;46156553]All HTML within your <?php and ?> must be echo'd. as following: [code] <?php echo "<html>"; echo "<body>"; echo "<p style=\"myClass\">Hello world!</p>"; echo "</body>"; echo "</html>"; ?> [/code] So to answer your question, yes, every line within your <?php ?> block contains about one error.[/QUOTE] Or he could just <?php ?> wrap the four snippets of PHP, which is way faster and works as well. To asker: The PHP tags are used only for PHP code. Adding html without printing it as a string will make PHP break, since it doesn't know what those < > things are. Also, adding @ in front of functions makes them not print any error. This might not be the best idea if you're trying to troubleshoot things.
[QUOTE=HiddenMyst;46156482]Hey guys, I'm pretty new to PHP and don't know all the quirks so far. I was restructuring my site, which was working up until my changes, and it looks like I've broken something completely. Nothing shows on the page now and viewing the page source is blank too. Can anybody see any glaring errors with this?[/QUOTE] What Cyberuben said. Also you can just put the <?php ?> on only the php content [code]<!DOCTYPE html> <html> <head> <title>mtmilo</title> <link rel="stylesheet" href="style.css" type="text/css" /> <script type="text/javascript"> (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js?onload=onLoadCallback'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); }); </script> </head> <body> <?php @require('functions.php'); ?> <header> <img class="topbanner" src="logo.png" /> </header> <aside> <nav> <?php @include('navbar.php'); ?> </nav> <div> <p>"Created by Miles Flavel"</p> </div> </aside> <div class="content"> <?php if(isset($_GET['page'])) { if(isValidPage($_GET['page'])) { @include($_GET['page'] . '.php'); } else { @include('invalidpage.php'); } } else { @include('main.php'); } ?> </div> <footer> <p class="copyright">"Be fair and share, don't be that jerk who steals"</p> </footer> </body> </html>[/code] [editline]5th October 2014[/editline] ninja'd :( there was a new page
[QUOTE=jung3o;46156620]What Cyberuben said. Also you can just put the <?php ?> on only the php content [code]<!DOCTYPE html> <html> <head> <title>mtmilo</title> <link rel="stylesheet" href="style.css" type="text/css" /> <script type="text/javascript"> (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js?onload=onLoadCallback'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); }); </script> </head> <body> <?php @require('functions.php'); ?> <header> <img class="topbanner" src="logo.png" /> </header> <aside> <nav> <?php @include('navbar.php'); ?> </nav> <div> <p>"Created by Miles Flavel"</p> </div> </aside> <div class="content"> <?php if(isset($_GET['page'])) { if(isValidPage($_GET['page'])) { @include($_GET['page'] . '.php'); } else { @include('invalidpage.php'); } } else { @include('main.php'); } ?> </div> <footer> <p class="copyright">"Be fair and share, don't be that jerk who steals"</p> </footer> </body> </html>[/code] [editline]5th October 2014[/editline] ninja'd :( there was a new page[/QUOTE] Yeah you are right, but since I never use that method I usually forget about it. Just doesn't fit my coding style, but it's up to preference of the coder.
[QUOTE=Cyberuben;46158079]Yeah you are right, but since I never use that method I usually forget about it. Just doesn't fit my coding style, but it's up to preference of the coder.[/QUOTE] but actually, it's a lot cleaner. you should not use echo if you don't have to. Also it's more manageable.
[QUOTE=jung3o;46158091]but actually, it's a lot cleaner. you should not use echo if you don't have to. Also it's more manageable.[/QUOTE] This along with [URL="http://php.net/manual/en/control-structures.alternative-syntax.php"]alternative syntax[/URL] when mixing HTML and PHP
[img]http://puu.sh/c0H3x/7b3ef639b9.png[/img] This is the WordPress plugin saying it's showing ads on my site. Yet, my account is awaiting approval. [img]http://puu.sh/c0GQq/15689e8dbb.png[/img] This says to get my account to receive approval, I need to place the ad code (Already done via the wordpress plugin) to progress onto approval. What do I trust? Any idea on what I should do? Do they have any immediate contact services?
Hi guys. Can anyone recommend a good free site design for presenting some galleries of pictures? Basically just for showing some photography stuff I do. I have only basic knowledge of how to set up an Appache server and putting some premade HTML in it.
a lot of people just seem to use tumblr for those kind of stuff
snip: very late
[QUOTE=Cyberuben;46158079]Yeah you are right, but since I never use that method I usually forget about it. Just doesn't fit my coding style, but it's up to preference of the coder.[/QUOTE] This is the way you SHOULD be doing it. Echoing HTML from PHP in strings is bad practice.
This is the correct way. [code] echo eval('ob_start(); print exec("php -r \'echo eval('<?php echo "<div>woah</div>" ?>');\'") echo ob_get_contents();'); [/code] For each line.
[QUOTE=CBastard;46163782]This is the correct way. [code] echo eval('ob_start(); print exec("php -r \'echo eval('<?php echo "<div>woah</div>" ?>');\'") echo ob_get_contents();'); [/code] For each line.[/QUOTE] Ugh there goes my free tuesday!
Anyone unfortunate enough to work with Vimeo's player API could tell me how to make the damn thing work? I have my iframe with id 'baa', I specify that same id on the URL (&api=1&player_id=baa), I include the frog-a-loop thing, even add an onLoad just to be sure... Then the player loads up correctly, but every time I try to call the api it just ignores me. [CODE]<html> <head> <script src="http://f.vimeocdn.com/js/froogaloop2.min.js"></script> </head> <body> <iframe id="baa" src="http://player.vimeo.com/video/75389095#t=0m9s?api=1&player_id=baa&byline=0&portrait=0&color=ffffff&autoplay=1" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> <script> window.onload = function() { sheep = document.getElementById('baa'); bee = $f(sheep); } </script> </body> </html>[/CODE] Now, bee is frogawhatever running on the iframe div, right? As the docs say, it should be just enough to run whatever you want into it. Well, I can't. [IMG]http://i.imgur.com/yKZt6an.png[/IMG] I haven't found anything on Google, and I can't try the deprecated flash api because it won't work either, and they must've forgotten to delete it off the help pages.
For those of you using gandi's SSL: [t]http://josm.uk/dl/gandi.png[/t] Been waiting for this for over 8 hours now. It said comodo checks ever hour. Any ideas? (Yes, I've installed the .txt file where it tells me to)
I don't know if any of you use Firebase, but I am wondering what is the best way to get more user information from registration? Right now I have this: [code] register: function(user){ auth.$createUser(user.email, user.password).then(function(data){ console.log(data); authServiceObject.login(user, function(){ emails.$add({email: user.email}); }); }); },[/code] Which creates a new user in Firebase. However if I add in stuff like user.firstname, it doesn't work. Should that be done separately or something?
Any way to make SteamAuth ( OpenID ) timeout faster? Also, if im using Steam Authentification, there is a way to ban someone from my website ( SteamID Ban )? thanks.
Been pointed/redirected here from Programming section of FP. So anyway: I am making a chat application which I want to work on Browser, Android and Windows Software (C# Probably). Now my main problem is setting up a framework/server that would allow all of the 3 to establish direct communication (Presumably Sockets is the way to go). So far I stumbled across Node.js and Socketo.me So I am wondering how would I go about setting up this server/framework? I am gonna host server on my own PC (since I don't have any resources or money available to rent proper servers) + this is project for college so it doesn't need to be large scale. Any suggestions where would I start? P.S - I cannot change idea of my project anymore, I am quite stuck with it. Main question is: How would I go about setting up this server basically and perhaps you have better suggestions than Node.js and Socketo.me ?
If you're a student, you can get some free stuff from [url]http://education.github.com/pack[/url] use the $100 credit for Digital Ocean and get a dropplet (vps) for up to 20 months for free. You should go with NodeJS using [url]http://socket.io/[/url] They have a live example running that you can check out. ([url]http://socket.io/demos/chat/[/url]) (Src: [url]https://github.com/Automattic/socket.io/tree/master/examples/chat[/url])
[QUOTE=jung3o;46177851]If you're a student, you can get some free stuff from [url]http://education.github.com/pack[/url] use the $100 credit for Digital Ocean and get a dropplet (vps) for up to 20 months for free. You should go with NodeJS using [url]http://socket.io/[/url] They have a live example running that you can check out. ([url]http://socket.io/demos/chat/[/url]) (Src: [url]https://github.com/Automattic/socket.io/tree/master/examples/chat[/url])[/QUOTE] Yeah apparently after looking at vouchers I remembered I have 499.97 $ left on Google Cloud platform so I guess I could use that? So from my understanding: I should host Node.js on google cloud along with socket.io socket.io will allow my android application (client) to connect to my cloud server and establish direct communication? P.S - shit, actually it just expired a month ago so once I start using google cloud they will charge the crap out of me. Will try Digital Ocean solution you suggested. P.S.S - just got the 100$ credit for Digital Ocean. Also as coincidence: Some guy from other course emailed whole 4th year students emails saying about this offer.
[QUOTE=KinderBueno;46177995]Yeah apparently after looking at vouchers I remembered I have 499.97 $ left on Google Cloud platform so I guess I could use that? So from my understanding: I should host Node.js on google cloud along with socket.io socket.io will allow my android application (client) to connect to my cloud server and establish direct communication? P.S - shit, actually it just expired a month ago so once I start using google cloud they will charge the crap out of me. Will try Digital Ocean solution you suggested. P.S.S - just got the 100$ credit for Digital Ocean. Also as coincidence: Some guy from other course emailed whole 4th year students emails saying about this offer.[/QUOTE] If you want I can help you install NodeJS. Digital Ocean also has great guides on it, but I have no clue how familiar you are with Linux. If you also intend on hosting website(s), I'd recommend installing NGINX and using that for your static file serving, then redirect your requests to the port your webserver listens on.
Please... never echo in basic php files where you don't use any functions/classes. if it should be handled like a normal html-file just don't code everything in php. Just wrap variables or functions with php tags and otherwise use html.
[QUOTE=Cyberuben;46179833]If you want I can help you install NodeJS. Digital Ocean also has great guides on it, but I have no clue how familiar you are with Linux. If you also intend on hosting website(s), I'd recommend installing NGINX and using that for your static file serving, then redirect your requests to the port your webserver listens on.[/QUOTE] actually we're trying to code a webbased teamspeak alternative based on node.js and binary.js on Github. unfortunely I don't have any shitknowledge about node.js and nosql-databases. If you're interested, you can help us. (everybody else here too.) project link: [URL="https://github.com/GamingCorp/Webspeak"]https://github.com/GamingCorp/Webspeak[/URL]
[QUOTE=Cyberuben;46179833]If you want I can help you install NodeJS. Digital Ocean also has great guides on it, but I have no clue how familiar you are with Linux. If you also intend on hosting website(s), I'd recommend installing NGINX and using that for your static file serving, then redirect your requests to the port your webserver listens on.[/QUOTE] Thanks I might come for help. Btw is it normal that I got cloud server at 2 AM, then bought domain name from GoDaddy at 3 AM. Changed nameservers etc... and then: at 3 AM when I entered my domain name, it brought me to GoDaddy website saying my domain is parked on GoDaddy, and now: 2:43 PM it doesn't even redirect to GoDaddy, rather it shows Page Not Available. How long on average does it take for nameservers to take effect?
you get a free ME domain from namecheap [t]http://i.imgur.com/lVmOsPg.png[/t] why would you get one from godaddy. What name server are you using?
[QUOTE=jung3o;46181704]you get a free ME domain from namecheap [t]http://i.imgur.com/lVmOsPg.png[/t] why would you get one from godaddy. What name server are you using?[/QUOTE] Well I saw great deal for .com , only 8 Euro for first year. I redirected domain to Digital Ocean.
what is the ip of the server? have you set up a webserver?
[QUOTE=jung3o;46182861]what is the ip of the server? have you set up a webserver?[/QUOTE] I assumed I can just upload index file to cloud and it will work auto? :L
[QUOTE=KinderBueno;46183234]I assumed I can just upload index file to cloud and it will work auto? :L[/QUOTE] :suicide: Here's a tutorial on just installing NGINX [url]https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-14-04-lts[/url] (This is your webserver) And a tutorial on installing nodejs [url]https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server[/url] (use installation via ppa)
Holy shit, thats why my domain doesn't work yet.
Sorry, you need to Log In to post a reply to this thread.