Jump to content

Ninjakreborn

Members
  • Posts

    3,922
  • Joined

  • Last visited

Everything posted by Ninjakreborn

  1. Thoughts: * Open cakephp and dig through there code. * Open Codeigniter and dig through there code. * Google up and split open/look through 2-3 random frameworks online After that you'll know exactly what your wanting to do. If you have never done MVC before then it might be better to get familiar with something already out there. It's not required but you'll have a better idea on something that is tried/true before you forge off and make another MVC pattern with no framework attached to it. Overall MVC isn't hard to keep even without a framework. Just seperate your content from your programming. Work on logical class structures and model structures. Work on logical view setup. The hard part is making them work together (generally that's what a framework does). It connects the 3 types (models, views, and controllers) and mixes them together in a coherent fashion so they are "Aware" of one anothers presense and but used together without a lot of working making them aware of each other. IF you create a class...a model...and a view. And that's it they have NO way of knowing between themselves that the others exist. Meaning you have to go out of your way to make the model realize what class it's meant to be used with, and telling the controller what view is suppose to be showing it's content. Then when you have to add in your JS and CSS it adds another layer to the problem. I recommending contructing a "Basic" framework around whatever your doing so the models know what controllers they go with and the controllers can easily access the models they need. You also want an easy way to tell a given controller what view it's suppose to open.. Folder structure is also very important and can go a long ways toward guaranteeing you have a decent development experience with the minimal of hassle.
  2. This is the wrong place to post this. I recommend Personal Experience. I use to think that a lot of reading would help but it doesn't. 10 years spent reading about how to do something is not going to teach you as much as 1 year of actually "doing" it. If you insist then head over to www.google.com and search "Safari Bookshelf". First result. Sign up and pay for an account and then you'll never again have to ask "What book should I read to learn this". There you can do a quick search and you will find almost every technical book that exists being displayed there that you can read in full. This is a very helpful site and it was the last time I ever needed to be a technological/language book again. I just go on there and perform a few searches...that mixed with google you can find almost anything.
  3. I don't recommend doing that. Getting a giant string with all of the content and echoing out the entire string as one variable (that's just me). As far as your problem. I am a little confused on what your trying to do? I think this is it based on what you said... Might not work but it'll give you something to play with. That's the generic idea. But I raelly don't like the idea of the code you found on the internet. It's really badly formatted and that MK line is actually going to throw a PHP syntax error. Never seen them try to format it that way before. It seems you want to get THAT day + the day before and show something different based on that. I havne't tested it but I worked up another set of code below that..it should do close to what you want but I don't have time to test it myself yet. It'll give you something to work with though that you can work off of and work out the bugs in. <?php //Display the row of data $output .= "<tr bgcolor=\"$bgcolor\">\n"; $output .= "<td>".$row['Receiver']."</td>\n"; $output .= "<td>".$row['Amount']."</td>\n"; $output .= "<td>"; $date = date('d/F/Y h:i:s a', strtotime($row['Date'])); $datebeforedate = date($date, strtotime("-1 day")); $mtdate = "<$MTEntryDate format="%m.%d.%Y"$>"; if ($mtdate == $today) { echo 'Today'; }else if { echo 'Yesterday'; }else { echo ("<$MTEntryDate format="%A"$>"); } $output .= "</td>\n"; $output .= "</tr>\n"; ?> Try This <?php //Display the row of data $output .= "<tr bgcolor=\"$bgcolor\">\n"; $output .= "<td>".$row['Receiver']."</td>\n"; $output .= "<td>".$row['Amount']."</td>\n"; $output .= "<td>"; $date_show = date('d/F/Y h:i:s a', strtotime($row['Date'])); $date_compare = date('d/F/Y h:i:s a', strtotime($row['Date'])); $date_today = date("m.d.Y"); $date_yesterday = date("m.d.Y", strtotime("-1 day")); if ($date_compare == $date_today) { echo 'Today'; }else if ($date_compare == $date_yesterday) { echo 'Yesterday'; }else { echo $date_show; } $output .= "</td>\n"; $output .= "</tr>\n"; ?> I am pretty sure the code under Try This will be what you are looking for. If it throws a syntax error or something let me know, I just don't feel like loading it up and checking it right now.
  4. It depends on what your trying to do. So you want to have the visitor work on something and then have a way to preview what they were doing before submitting? What are they going to be working on that they need to preview?
  5. What I generally do for debugging is actually create a seperate class for debugging. Make sure it's attached to all pages (just like your normal config classes would be). Then you can do a simple file log for any errors and/or messages you need. This will generate a file that will can view that shows the errors. If you want a good example Cakephp framework has a very good functioning example of this. Anywhere through there system you can perform... $this->log(); Within that function you can pass a string of what to print out and/or just pass it as is and it'll show an error was thrown. You can also use it to pass an array into it and it'll print out the array into the log file. I recommend you download cakephp and break open the code and hunt down there log function. It'll teach you everything you need to know. It saves all of the log information into the log folder. If you pass it a constant for DEBUG then it prints out the array and creates a debug.txt for it. If not then it just shows in error.log that it was an error and what time and everything else. Looking at it function is a marvel. Dig through the code for a minute and you could easily replicate a stand alone class that can do the same thing (it's just simply saving something into a file). This is VERY VERY helpful when doing heavy ajax. It's sometimes hard to see what is being returned when doing an ajax only call...being able to log it and check the file afterwards is VERY helpful. If you need anymore help post here.
  6. Moving your site into a random collection of random classes would be unwise and not very productive. Classes are good...but they need to be used in the right way(s) in order to help more than hurt. I would create 1 class for each "type" of page structure you need. Note to mention you would need a dispatcher class and a front controller. If you don't have a framework you can use one of the existing frameworks out there that have gotten a great deal of attention. Code igniter, cakephp are 2 of the biggest out currently. There are others but those will give you something to look at. But as far as "Classes" (not including the front controller and routers and whatever classes you'll need to call the pages as needed) I general prefer a grouping approach. My user's class wuold contain all functions related to registration, login, logout, user security, forgot your password. This would handle all actions related to "Users". Including showing/editing there profiles. Then I would have a second class to handle my database "Items". Reviews/interviews/news. IF one of those items are going to be used for many different things I might split them up into seperate classes to keep it neat (one for reviews, one for interviews, and one for news). For the staff just create a staff's class that will handle everything for the staff (there login, logout, edit, view profiles) and everyting else. You need one to handle there "Admin" functions together or put them all together under the same admin class. The table could be brought about using a function in the users class. You would need a front end class seperate that is going to "Recieve" the incoming url/post methods and help decide what pages are going to be shown. I would recommend a class seperate that can handle loading the config options (if you have any) You are also going to probably have helpers, and js files, and stuff that you will need to developer a "Loader" for.
  7. Theoretically it wouldn't be very hard to just check and see if there is updated content. Generally when something cache's but updates as needed the person might keep a log of files and there "size". There cache system might use something to verify whether or not the current size/modification date matches that on the one that's cached by the system and replace them as needed.
  8. What I generally recommend to someone wanted a "test" project is a Personal Management System with some basic beginner features and build onto it as you learn more about what your doing. Something along the lines of a personal management system that can: * Add/edit/delete/sort/filter Contacts * Add/edit/delete/sort/filter notes * Add/edit/delete/sort/filter to do list(s) Once you get that up and running from trial/error you will know what you need to about PHP and Mysql to be able to expand it far beyond those basic features. From there you could start adding in a recycle bin where deleted objects get categorized and then sent to the recycle bin. After 30 days they get deleted unless you purge them from the system before then. Once those features are done you can expand it even more by adding new modules after that. One pretty challenging thing you might find really exprience increasing is changing frameworks in the middle of the project. Start using it in Codeignitor (or your own framework) and when it's done move it over to cake. The act of changing it from one framework to another and ironing out bugs as you go not only teaches you how to setup/use those other frameworks but teaches you a lot about how PHP works from application to application. Then move it back to code ignitor, then back to cake, then back to the one you started on. Each time you'll notice differences in the applications but the way they are setup are the same. Meaning you'll get to the point where you can function your way through an existing app by just being able to pour through the codes, examples, and forums and piece together what you need about how something works. Allowing you to make changes to already existing apps which is a good skill to have. Either way good luck.
  9. I have always wondered how to do this. Array Products [414] [525] [3] [test1] [test2] [test3] [223] assume each one has a giant subarray of whatever foreach ($products as &$k) { $products['test1'] = 'yes'; $products['test3'] = 'no'; if (is_numeric($k) { } } In this situation how can I tell what "k" is set to since I need to access for example $products['223']['subkey'] Then how would I know which number I was currently at?
  10. I still need this function if anyone has something?
  11. Does anyone have/know of a function that does the "EXACT" same thing strptime does (takes parameters in the same order, and does virtually the SAME thing to them) that'll work in windows. I need to replace a strptime function with something else that'll work in windows, however it's handled differently so I am hoping I can just replace $pdate = strptime($str, $format); with a call to another function that'll do the same thing.
  12. Ah ok, but I found a good solution too. <?php // years to keep creation $years_list = $years; // add one year $years_list[] = min($years) - 1; // remove one year $years_list[] = max($years) + 1; // order them sort($years_list); // here is what I used to take and remove everything that is in years list that is in years $years_list = array_diff($years_list, $years); // reorder them again sort($years_list); ?>
  13. Let's assume I have an array as follows: Assume that is my current array above. Now let's say I wanted to take and remove 35 from that array. So we would be left with all of those key/value pairs except the one's I wanted to remove. I need to figure out how to do roughly the same thing except it would be dynamic. I am creating an array of years (which I have). Then I have a list of excluded years. I ned to be able to remove all variables that are present from the excluded years list out of the valid years. For example I might have Years to keep Years to remove Now how would I make it so that all of the years to remove, are taken out of the years to keep array so I just have the years left that I need?
  14. What exactly is your problem? Are you wanting to stop the expanding, or what. When I go there I see it expanding, what exactly are you trying to make it do that it's not already doing?
  15. You will need * Css * Javascript Google either "Javascript rollover menu's" or "CSS Rollover Menu's"
  16. I am trying to learn the LUA language to an extent. I am wanting to write world of warcraft add-ons. The language itself isn't much of a language as far as learning. It's a pretty basic language, with rather basic syntax. There are some modifications to it due to the world of warcraft api that changes the way the language functions slightly. I am trying to write a basic add-on TOC File ## Title: MultiAddon ## Notes: This is a multi add-on that encompasses many different features over many different areas. See features list/change list for more data ## Interface: 20300 ## DefaultState: enabled ## Author: Joyel Puryear ## Version: 1.0 MultiAddon.xml MultiAddon.lua Lua File // function to be called on wow load function MultiAddon_load() SlashCmdList["MULTI_ADDON"] = MultiAddon_runcommand; SLASH_MULTI_ADDON1 = "/MultiAddon"; end // Run command functions when /test1 is called. function MultiAddon_runcommand() logout(); end Xml File <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd"> <Script file="MultiAddon.lua" /> <Frame name="MultiAddonCore"> <Scripts> <OnLoad>MultiAddon_load();</OnLoad> </scripts> </Frame> </Ui> Ok. Basically this isn't working. I practically know XML. I have studied some LUA, enough to be able to do this. IT's got something to do with how I am structuring the files. I have rewritten the coding for it 5-6 times, studied all resources I could find online. It has something to do with either the onload not loading, or the slash commands not registering properly. THere are limited resources online available for this. using some of the wow fan sites, wow wiki's and multiple tutorials I understand a lot about how to do some things. But I am trying to get this first test add-on working so I can build off of it, does anyone see anything obvious that might be wrong?
  17. Perfect. that should give me everything I need to advance further for awhile. I was frustrated because when I was writing test applications just to try and learn the language, It kept running so fast I couldn't even guarantee it worked. I had written some stuff to do calculations, tried to make a test calculater. Then I was trying to work on a basic interface. However I couldn't get past that one part with it. Now I should be able to write something decent and be able to use that to test it. Thanks for showing me that, and thanks for all of the advice. I really appreciate it.
  18. #include <iostream> using namespace std; int main() { cout << "Hello world!\n"; return 0; cin.get(); } #include <iostream> using namespace std; int main() { cout << "Hello world!\n"; return 0; system("pause"); } For some reason neither of those worked. It still jumped straight through. It displayed hello world (so fast the human eye can't see it), then existed out of the window. Any advice? @Daniel0 - You mean to compile it, then run to teh application directly. The editor I am using has a built in compiler, and allows you to run it "through" the editor (it has a menu option for compile, and a menu option for run. Is that what you mean?
  19. Basically how do I make a C++ application stop, so I have to click x in the window to close it. Everything I try to create ends up being a quick running app. It *Opens * Runs * Closes lightning fast. Is there a way to write an interactive one, that doesn't close so fast.
  20. Basic application #include <iostream> using namespace std; int main() { cout << "Enter your age: "; int age; cin >> age; if (age > 20) { cout << "You are still young! \n"; }else { cout << "You are not so young anymore! \n"; } } Problem * I write this app * I compile it * I run it. Basically what is happening is it prompts for the age. You enter the age, and it automatically closes out the application. It's not showing one of the text messages (based off of what age you are). What am I suppose to do to be able to make it "stop" at a specific line. For example if I write 15-50 pages of code that just initializes various variables, does some things to them, then outputs them to the screen it runs too fast. It open's the app, and then runs through them all lightning fast then closes down. What do I need to do to make it to where it run's the lines, but where I can read them, then close the app down as I choose.
  21. I am better at maintainable code. I have learnt to use both cake, and code ignitor as advised awhile back. I have also learnt OOP, and I write in it regularly now. Almost all of my general programming ends up being object oriented now. Naming conventions, clean programming, modularity. General programming concepts. I have had a decent amount of experience with each.
  22. I have been through a lot lately. I went from freelancing, into finding a friends with lot's of experience. He got me on a long term contract for a high level app creation I could do from home (with him acting as primary developer). Over the course of the last 10 months, I have pretty much dug deeply into things I never knew before. Learning PHP to the point where I felt I was ready to start delving into some new languages on the side. He even helped get me to the point under desktop app's where I can start writing some basic apps in otehr languages. Well it's come time for me to decide on a few things and I wanted some feedback. I have always programming in dreamweave. So far every language I needed was inside of dreamweaver there with mini-reference system that I could get into as needed. It also had basic layouts for each page (like if you chose html it'll put all the basic's in there, same for xml, php, asp, and whatever other languages I have needed so far. It even helped me the few times I needed to get into cold fusion. So now, I am starting to look at some of these higher end languages. Delphi, C++, .net related programming languages (heavy asp, asp.net, c#, and similiar languages), java programming, python, perl, and a few of the other languages that were related. I am the exploring type. So I expect to be jumping around testing languages a little here and there. Well what I am tryign to figure out now is there a way to setup dreamweaver to work well with these other languages (C++ and delphi especially). I want to set stuff up but I am going crazy trying to decide over dreamweaver CS3 which is what I have used for the longest (cs2 before that) or go ahead and start using an editor with built in compiler (kind of like visual C++ 2008 or something). Pretty much I see a lot of things in visual basics 2008 for c++ I don't see * Really good C++ syntax highlighting * Built in function reference * Built in compiler. I could just use it, but then I might decide I feel like doing some python later, or some delphi. I don't really want 5-8 different editors, one for each and every language I want to play with and potentially learn. Is there a way I can modify dreamweaver to use those languages, or what do you use for your C++ programming that you can still use for your other programmign. I went through many editors for awhile trying to find something better than dreamweaver that suited what I wanted, but so far could find nothing.
  23. I hate magic quotes. They are a very annoying feature. There is something yuo can do about that to work around it. Below is an example of how to do the method universally so it can tell whether they are enabled or not. <?php if (!get_magic_quotes_gpc()) { // escape your variables. } ?> What this will do is check to see if magic quotes are disabled. If magic quotes are not turned on then it will escape, if magic quotes is turned on then it will pass right over your if control construct like it isn't there. Then you are guaranteed to have escaped values whether magic quotes is on or not, without falling victim to what barand mentioned above.
  24. $_SESSION = array(whatever in the array); then you can access it the same as any array. $_SESSION['arraykeyhere']; So basically save the entire array into an array. Then merge that array into session like. $myarray = array(); then fill my array with whatever you want and then $_SESSION = $myarray; That is one method. The other is to use $_SESSION['subkey'] as your array. (makes it cleaner). $_SESSION['my_array'] will be your top level array. Then put your other keys and values underneath the my_array key. This is so if you needed more than 1 seperate array in session you can do $_SESSION['my_array'] $_SESSION['user_data'] $_SESSION['system_data'] and each one can be a seperate array or a multi array.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.