Everything posted by Dream Of Sleeping
-
Starting up the application reusing objects
As it turns out Ipage use php version 5.3.13. which rules out just about every framework I've looked at.
-
Starting up the application reusing objects
It definitely has clearer instructions than the other one. I need to check to see if it's compatible with my hosting company, ipage. If it is I'll give it a go. I've been looking at Yii, that looks pretty clear too.
-
Starting up the application reusing objects
That's kind of the same thing I went through making games. When I started off I wanted to write every line of code myself, and everyone was saying use a framework, but I found them intimidating. My last couple of games I started using a framework, and I wished I'd tried it sooner. It actually taught me a lot more about how to structure my code and it wasn't that bad when you just dived in. It was well documented though. Shame about code igniter, it had such clear instructions and tutorials. I do understnd the bascs of oop, but just not in regards to websites yet. I'm dedicating an hour and a half a day to going through code examples in books, and tutorials, and another hour and half making simple websites. I can't believe how slow I am at making a websites. So much I have to learn. I have an idea of a very complex website. That's why I've started in the first place, but now I'm realizing It will probably be about a year before I start it.
-
Starting up the application reusing objects
I looked at the inroduction on the Silex page. There so much I didn't understand I couldn't possibly use a framework like that yet. It already assumes you should know far more than I know.
-
Starting up the application reusing objects
I'm just learning the basics of php and mysql at the moment. But after I've made a few small websites to practice I think I will go with code igniter, as it seemed like the most straight forward. People always throw that reinvent the wheel phrase around to newbies who are trying to understand what the wheel actually is.
-
Starting up the application reusing objects
This is what I was trying and failing express http://stackoverflow.com/questions/1023282/maintain-object-state-with-different-pages-using-php .And answers my question. It was confusing me about keeping objects alive, but I see you pretty much just don't. That's gong to take some getting used to. But that tutorial, Weedy101, is awesome and very clear. Thanks again.
-
Starting up the application reusing objects
Thank you I will check out that tutorial. I'm not sure what you mean by class file should be in the background? Can you clarify please? I already have quite a bit of experience with javascript. I've made serveral quite complex games javascript, and I have made games in java. So I'm used to making objects. It's more of how to specifically do it in a website that's giving me trouble. I'm only just started learning php though. Thanks again for the link.
-
Starting up the application reusing objects
Sorry to post two topics in one day. I've been trying to get to grips with how to struture a very basic application. I've been trying to separate logic from the view and minimize global variables, like I keep reading you should do. The question I have about is the startup of an application. .<?php include('model.php'); $secretConfessions = new SecretConfessions(); class SecretConfessions { private $model; function __construct() { $this->model = new Model(); $this->go(); } function go() { if (isset($_POST['add_confession']) && isset($_POST['the_confession'])) { $this->model->addConfession($_POST['the_confession']); header('Location: secretconfessions.php'); exit(); } $confessions = $this->model->getConfessions(); $this->renderView($confessions); } function renderView($confessions) { include("view.php"); } } This will probably end up being my index page. Now at the top of the page I create a SecretConfessions object which I'm trying to make act as a controller, This contains the model (it won't always be called model). At the moment every time the user adds a confession (just an anonymous post) they will be redirected back here. But that will create another SecretConfessions object which will create another model object. How do I start of an application like this so it just creates the objects it needs once, without it doing it all again when the form is submitted. How would a website like twitter (but much much simpler) start up? Does it keep variables the whole time the user is adding posts?
-
Am I using a form where I shouldn't be?
Thank you very much. That works great.
-
Am I using a form where I shouldn't be?
Hello. I've been learning php, and I'm trying to make a simple website just as an excerise. It's called Secret Confessions. The user types in a confession and it posts to the page. That's it so far. I've used a form for this. But when I type in a confession post, then refresh the page I get a warning. Something like "Returning to the page may cause information to be repated". And information is repeated as the variables are still set. Now if this was twitter, or a facebook post, obviously you don't get this kind of warning. So should I not be using a form here at all? If not what should I use for this kind of thing?
-
Is this a terrible domain name?
What about revieweachother.com ? 3 words but it's discriptive. I think you could guess what I'm planning.
-
Is this a terrible domain name?
Thanks for the opinions, so far. My main concern with reviewreviewed is that it seemed a bit clumsy to me. Typing it out makes my eyes go funny. haha
-
Is this a terrible domain name?
reviewreviewed.com I've bought it just in case I decide to use it. (There's nothing there yet except my regular music site which was just put there automatically, so don't bother going there). What about songreviewgroup.com is that any better?
-
oop not quite working
In the first example it does not cause an alert because the alert is in the sayName function. To call it, add this code. person1.sayName();
-
Dynamically added elements disappear.
From what I've been reading, if you want to place the button inside a text field, you will have to do it with css and use relative positioning. I can't get this to work. If you take a look at this code. I'm trying to pass the idName I have created for the span element to the removeElement fucntion. But it does not work. It doesn't work because it ends up not passing the id name at all. If I place the idName in strings, if I try to append it as a string, or i've (as below) just stuck the name in there. I don't understand how I would do this or why this isn't working. Any ideas? it seems that the variable is out of scope when it gets called. Are the no experts reading this who can help us out? var idIndex = 1; function addField(element) { var field = document.getElementById(element); var spanElement = document.createElement("span"); var idName = "input" + idIndex; idIndex++; spanElement.setAttribute("id", idName); spanElement.innerHTML = "<input type='text'>"; spanElement.innerHTML += "<input type='button' value='X' onclick='removeField(idName)'>"; field.appendChild(spanElement); } function removeField(id) { // for some reason this is not receiving the Id name, so below code doesn't work. var element = document.getElementById(id); element.parentElement.removeChild(element); } Edit: spanElement.innerHTML += "<input type='button' value='X' onclick='removeField(idName)'>"; Ok so what is happening above is it's creating html text that would try and pass a variable named idName, which would not exist when it's called. However if I put quotes around idName, it then just passes a string named "idName". What I need to figure out is how to pass a string that says what the variable idName actually equals.
-
Dynamically added elements disappear.
Ok it was bugging me too much to stay away from this. One mistery solved. The reason that appendChild has not being working is because you used <button> tags, instead of <input> tags. I don't even know if button tags even exist. I've changed the button code to this. This is how I have seen it done. Now at least appendChild works which will make the next part easier. <input type="button" id='add_field' value="add" onclick="addField('field_area')"></input>
-
Dynamically added elements disappear.
It's weird, I'm getting strange results that I just don't understand. The code was getting cluttered with all the innerHTML += statements. So I tried going back to appendChild, and still had your initial problem of the element just disappearing. And I have no idea why. Also I'm getting weird reseults of passing id names to the remove method, but instead of it being the id name that gets passed, it is in the element itself. Weird!. It looks like I have lot still left to learn. If you are still stuck I will come back it to tonight and have another look. It's a good learning experience for me. I have to go do something else now. Good luck though!
-
Dynamically added elements disappear.
You haven't included the code for your removeField() method. I'll be happy to take a look at it. As for the buttons overlapping: I added the new addField method to the code you already had, and the buttons are not overlapping. Each button is next to each text input. I don't have your css file so maybe that's causing you the problem.
-
Dynamically added elements disappear.
Maybe the problem is you were trying to set the innerHTML of the input you were trying to create, rather than add to the innerHTML of the element that contained it. As I say I'm new, but that seemed to me like it could be the problem.
-
Dynamically added elements disappear.
Hello. I'm very new to this and I'm not sure I understand what it is what you want to do but... function addField(element) { document.getElementById(element).innerHTML += "<input type='text' name='myInputs[]'>"; } I commented out some lines of code, and added one line. Try this out and tell me if this is what you wanted the code to do.
-
Where to store my lyrics
Ok maybe I waffled on too long to get a reply. So I will try and explain more briefly this time. http://dreamofsleeping.bandcamp.com/ If you go here and hover the mouse over a track name, a "lyrics" options appears. When clicked the lyrics are added to the page. I want to add lyrics to my page. Where do I store my lyrics? In a separate file? Can I do this with javascript or do I need php?
-
Where to store my lyrics
Hello. I know a little bit of Javascript but so far I have not learned any php. So it may be possible that this topic should go in the server side forum. Not sure yet! On my website if you click a song name it embeds a music player. I used javascript to do this and stored the embed codes in the javacript file. The codes were all the same except for song numbers and such, so I stored the song numbers in an array, so I just needed the one embed code, so it didn't take up that much space. Would this be considered a bad thing to do? I notice the page won't validate because of some of the characters in the embed code. Now for my main question. I want to have a link that when clicked embeds the lyrics on the page too. But where should I store all my lyrics? I could put it in the javascript file but I wasn't sure if that would be considered bad practice. I also want to have a link that embeds guitar tabs of the songs too. So the javascript file would be huge. So I wondered what would be considered to be the right thing to do in case like this. Should I read the lyrics and guitar tabs from a file? If so can I do that with javascript, or do I use php?
-
I could do with some guidance. First attempt at making a website.
Haha yeah, I think you are right. It might be the font having that colored in by crayon look about it.
-
I could do with some guidance. First attempt at making a website.
Thank you! That's very flattering that you would ask for my advice. I don't think I am qualified to give it though! Basically I just set my sights low, and tried to keep it as simple as possible. I put everything on one page because it was easier. I made the page have a fixed width because it was easier. I gave it a white background because it was easier. All with the intentions of improving and getting more ambitious later on. I would rather keep it simple and pull it off, then make it a complicated mess.
-
I could do with some guidance. First attempt at making a website.
Thank you very much for your detailed reply. And also to everyone one else who has replied. Lots useful information there. I'll look into that font face thing. Thanks again.