PHP - Moved: Getting Started With Cakephp...help
This topic has been moved to PHP Applications.
http://www.phpfreaks.com/forums/index.php?topic=332465.0 Similar TutorialsThis topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=352357.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=308958.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=352519.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=353428.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=352167.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=353875.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=347122.0 I'm going to go for broke here as this is the last thing I can think of that is going to help me learn anything... First things first. I have been reading tutorials and guides and all other things about PHP and playing around with all the codes from these tutorials and guides on my localhost. All work well. Yet, they haven't really taught me a great deal since all the code is already written and it's extremely hard to customize with the limited knowledge I currently have. I do not learn very well from sitting down and reading something that someone else has already written and then trying to work out what all the parts are. When I look at some code - I can usually figure out what is happening and what the code is doing. But it doesn't really help me understand how to write the code myself... So I thought if I made a topic where I get people to help ME write out a complete code.. I would actually learn something as I go along.. asking questions where I need to and building it exactly the way I want it. Note the 'ME' is capitalized. I don't expect everyone else to write it all down for me. I want to write it - have you guys give it the ok and we'll move on to the next bit. I know there will be parts where I am completely lost and I will need people to write down something to keep the whole thing moving. I would then ask questions untill I understood what you have provided. The whole idea of this is to build a User Login/Management system. If anyone is up for supporting this idea and helping me start from scratch let me know. Otherwise I'm not sure what else I'm going to have to do. Hi guys, I am new to php and mySQL. I am trying to just learn how to input and output data to a mySQL database. What I want to do is have a single page with a text area and button where a user can enter some text and then press a submit button. When the button is pressed I want the text that the user typed to be entered in my database and then displayed below the text area. If you have any questions about what I am trying to do please ask. Thank you for your help in advance! I'm trying to learn how to create a simple API, possibly using REST. I found a lot of online tutorials on how to implement API's but how do I create my own for my own website? The API I want to make is just for querying simple data and inserting data in the DB. From what I learned, REST does HTTP requests from a XML or JSON file but is REST a script I have to download, I can't find a REST site. I'm confused.. Hello, I've just begun learning PHP and I've gotten a bit into it, but I'm nowhere near a pro. Now, I've decided to start a project that will, in my opinion, help me learn a lot. I'm just having a bit of trouble understanding exactly how to do a few things. My goal is to take the PHP forum base found here and turn it into something similar to this. I've made changes of my own to this forum base and have already finished the news posting section of it on the front page. (almost, one issue with that, more on that in a sec). I've also removed this portion: if(!$action || !in_array($action,$actions_array)){ $sql1 = "SELECT * FROM `forum_cats` WHERE `admin` < ".$row['admin']."+1"; $res1 = mysql_query($sql1) or die(mysql_error()); $i=1; while($row2 = mysql_fetch_assoc($res1)){ echo "<div id=\"fcontent\">\n"; echo " <div class=\"header\" id=\"header_".$i."\" onMouseOver=\"this.className='headerb'\" onMouseOut=\"this.className='header'\">".$row2['name']."</div>\n"; $sql2 = "SELECT * FROM `forum_sub_cats` WHERE `cid`='".$row2['id']."' AND `admin` < ".$row['admin']."+1"; $res2 = mysql_query($sql2) or die(mysql_error()); while($row3 = mysql_fetch_assoc($res2)){ echo " <div id=\"content\">\n"; echo " <a href=\"./index.php?act=forum&id=".$row3['id']."\">".$row3['name']."</a><br>\n"; echo " " . $row3['desc'] . "\n"; echo " </div>\n"; } echo "</div>\n"; $i++; } }else { from index.php so that instead of the links displayed as they would be on a forum, they can be displayed in a navbar off to the side as on the example site (this). That point leads me to my next point: the navigation bar. I'm looking to create the same sort of look (in terms of layout, not the whole.. dark design harry potter thing) as the example site, but I don't really understand how to make navbars on the sides of the whole.. news section. I just need a basic explanation of how these things can be done, but please do not give things away. After all, it is a learning experience. All help is appreciated, though! Also, let me know if you need any more information or if I was unclear. Thanks, Fae Hi guys, Just starting to play with PHP Domdocument, only to fail at the very first step: <?php $html = 'test/php/somefile.html' ; if(!empty($html)){ $dom_1 = new domDocument ; $dom_1->loadHTML($html) ; $links = $dom_1->getElementsByTagName('li') ; foreach ( $links as $link) { // echo $link ; echo $link->nodeValue, PHP_EOL; } } ?> When I visit it in a browser I get a WSOD, what am I missing? Hey Guys, Im having a really frustrating problem with this set of PHP: writeConversationFunctions.php <?php session_start(); the function writeMessage($message){ $_SESSION['messagetest'] = $message; $chatLogFile = "log.txt"; $openChatLog = fopen($chatLogFile, 'w') or die("Failed to open Log File."); if($message == "resetnow"){ $message = ""; fwrite($openChatLog, $message); fclose($openChatLog); $_SESSION['lastMessageSize'] = 0; } elseif($message == ""){ } else{ $timestamp = date("h:i"); if(isset($_SESSION['username'])){ $username = $_SESSION['username']; } else{ $username = "Anonymous"; } if($message[0] == "/"){ $commandString = stripslashes($commandString); $commandString = htmlentities($commandString, ENT_QUOTES, 'UTF-8'); $commandString = substr($commandString, 1); $command = explode(" ",$commandString); switch ($command[0]){ case "slap": $name = command[1]; $commandResponse = '<p class="commandText">' ."You slap " . $name . "across the face.</p>"; fwrite($openChatLog, $commandResponse); fclose($openChatLog); break; } } else{ $message = stripslashes($message); $message = htmlentities($message, ENT_QUOTES, 'UTF-8'); $message = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1" target="_blank">$1</a>', $message); $messageString = ' <p class="message"> <span class="timestamp">' .$timestamp . '</span> <span class="username">' . $username . ': </span>' . $message . '</p>'; fwrite($openChatLog, $messageString); fclose($openChatLog); } } } writeMessage($_POST['message']); ?> Simply, the session at the top will not be created for some reason. The post data is sent from: index.php Code: [Select] <?php session_start(); ?> <!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" /> <link rel="stylesheet" type="text/css" href="styles.css" /> <title>Chatulo.us</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script> <script> var n = 0; $(document).ready(function () { var focused = true; $(window).focus(function () { focused = true; f(); }); $(window).blur(function () { focused = false; f(); }); var title = document.title; var f = function () { if (focused) { n = 0; document.title = "Chatulo.us / Home"; } else { // none of that else if needed here, you're only checking is focused or not. if (n == 0) { // now you're checking if its zero, so ... document.title = "Chatulo.us / Home"; } else { // you need ELSE here, otherweise you'll always use this next clause document.title = "(" + n + ") " + "Chatulo.us / Home"; } } }; function playSound(soundfile) { document.getElementById("dummy").innerHTML = "<embed src=\"" + soundfile + "\" hidden=\"true\" autostart=\"true\" loop=\"false\" />"; } $.ajax({ type: "POST", url: "loginHandlers.php", data: { required_function: "checkSession" }, success: function (response) { $('#usernameBox').html(response); } }); $("form#sendMessageForm").submit(function () { var message = $('#messageInputField').attr('value'); $('#messageInputField').val(''); $.ajax({ type: "POST", url: "writeConversationFunctions.php", data: { message: message }, success: function () { update(); } }); return false; }); function update() { $.ajax({ type: "POST", dataType: "json", url: "readConversationFunctions.php", data: { required_function: "readConvo" }, success: function (message) { if (message.newmessage == true) { $('#messageBox').html(message.message); playSound('sounds/pop.mp3'); n = n + 1; f(); } else if (message.newmessage === false) { $('#messageBox').html(message.message); } }, complete: function () { setTimeout(update, 1000) $("#messageBox").attr({ scrollTop: $("#messageBox").attr("scrollHeight") }); } }); } $("form#getUsernameForm").live('submit', function () { var username = $('#usernameInputField').attr('value'); $.ajax({ type: "POST", url: "loginHandlers.php", data: { username: username, required_function: "usernameHandler" }, success: function (response) { $('#usernameBox').html("Processing..."); setTimeout(function () { $('#usernameBox').html(response) }, 1000); } }); return false; }); $("span#logoutText").live('click', function () { $.ajax({ type: "POST", url: "loginHandlers.php", data: { required_function: "removeSession" }, success: function (response) { $('#usernameBox').html("Processing..."); setTimeout(function () { $('#usernameBox').html(response) }, 1000); } }); return false; }); update(); }); </script> </head> <body> <form method="post" name="messageInput" id="sendMessageForm"> <input name="message" id="messageInputField" type="text" autocomplete="off"/> <input name="submit" type="submit" value="Send"/> </form> <div id="messageBox"> </div> <div id="usernameBox"> </div> <span id="dummy"></span> <img src="images/logo.png" width="175" height="50" alt="Logo" id="chatulouslogo"/> </body> </html> Any help with this issue would be GREATLY appreciated! Regards, Cody I have a php file with a ton of vars that i need to access in a number of controllers. How can i simply include this file into a controller in cakephp? ~John I hear CakePHP 3.0 being talked about like its something for the future but I also see that you can download it and there are tutorials for it out already. Is it ready for developmental use, or is it still too early for that?
I am looking to learn CakePHP are there recommendations for tutorials on CakePHP?
hey guys i'am newb in php and i'am doing some algorithm in php, in some codes i need to use session but in that particular page the code does not know if session_start() has been called or not. wonder to if there is anyway that i can get if session is started or not in my code? thanks in advance Hey all, I'm using cakephp and it asks me a question and I'm not sure what to put in, because I don't necessarily know the consequences of what I put in: Code: [Select] Would you like to create the methods for admin routing? (y/n) [y] > y You need to enable Configu :write('Routing.admin','admin') in /app/config/core.php to use admin routing. What would you like the admin route to be? Example: www.example.com/admin/controller What would you like the admin route to be? [admin] > Thanks for response I am looking for a blog app or also a magazine type web app for CakePHP to learn from - any suggestions?
Hello,
I have been using cakePHP now for a couple projects now. My next projects involves creating a web service and the entire front-end be built in angularjs.
Now, I understand how 'Form' Authentication works, and have done some research and people tell me if I have an SSL to use Basic Auth, for a web service, which is what I am using. But I am having a problem hooking both up nicely. Now with angular, I have a call for a page and send over the username and password. If the credentials are correct, the server returns back the correct data. The problem is if the credentials are wrong, I get the normal 'Basic Auth' pop up, asking me for my username and password.
My question is, instead of the server trying to re access the same page, is there a way to return json data back?
Example : I have an angular call going to 'cakerest/projects.json' -> Credentials are ok -> Data is returned, and with javascript I console.log it and see it.
2nd time I send the incorrect user and password, and the server responds back with a popup asking for credentials.
How can I get rid of that popup and just return "{Error : 'Credential problem'};
I can post code if that would help as well.
Thank you
|