
jcarney1987
Members-
Posts
10 -
Joined
-
Last visited
Everything posted by jcarney1987
-
Trying to server different Smarty Templates on Single Page
jcarney1987 replied to jcarney1987's topic in PHP Coding Help
Well I do plan on picking up some frameworks eventually. I know a lot of people always criticize me for reinventing the wheel, but I enjoy doing it. I guess the reason why I'm like that, because when I tried to learn c++ it became to the point where I couldn't make anything worth making and understanding the OOP portion of it for me was a real stinger as well. That was 10 years ago, and then I picked up perl and started to learn how to do things with it that was usable, but dealing with frameworks and template systems was still a pain in the ass. Of course having a full time job prevented me from continuing learning, so now I picked up PHP and I hate how the code naturally allowed to be a total disaster, but I'm figuring it out and making it better every day and being better and building OOP projects. I like building things from ground up, kinda like building cars you know. Tear it down and redo it all. But I do plan on sticking with it, picking up Javascripts, and possible another language too, but I'm going to get proficient in php because I believe I'll continue to use it for at minimum the next 7 years. -
Trying to server different Smarty Templates on Single Page
jcarney1987 replied to jcarney1987's topic in PHP Coding Help
It's not a big issue, but in the end, it do want something that is decent. I am learning, so I'm sure the whole Idea of this is going to be a rewrite, so I'm just learning all the core work before I jump into more advanced frame works. Right now I'm just trying to get comfortable with OOP with the MVC model. So I'm basically writing a practice app that I hope will be able to help me in my full time job managing hvac and these are my goals. Use MVC Model Keep logic from display seperate Keep public accessible pages categorized per option. Example, I want customers.php to handle most customer front in display, jobs.php handle all jobs display etc. I guess I could seperate it into more multiple files, but my attempt is to keep similar tasked group so I can manage it better. So either way, I'm always looking for a new way to do something better within the scope of my own understanding, because I'm still a novice. -
So I'm learning OOP PHP and I'm working on Seperating all my logic from display. So given than, I have a page that displays all my customers, but on the same page if I choose to add a new customer, I played on using the same PHP file to server up a new smarty template, but this is where I'm not sure how to do this without making it look funky. I started off by passing a Get Method such as https://localhost.cxm/contact.php?addcustomer=1 but I wanted to know if there was a better way to clean it up instead of making the link like that. Here is my code if ($logged_in == TRUE){ $smarty->assign('firstname', ucfirst($_SESSION["useruid"])); $smarty->assign('customers',$customer); $smarty->display('template/glory/header.tpl'); if (!empty($_GET['addcustomer'])){ $smarty->display('template/glory/addcustomer.tpl') } else { $smarty->display('template/glory/customer.tpl'); } } else { $smarty->display('template/glory/login.tpl'); } ?>
-
Yes, I do use Linux as my Base system and I plan on using Linux and FreeBSD as my base WebServers. Composer does sound great in the long run, right now I'm more concerned with learning and understanding the language better before I break off and start learning package managers and frameworks. It's all good stuff.
-
so I guess I don't understand the internals of spl_autoload_register. So if I call for Class Hello { //some code here } it looks for the file based on class name. I was thinking it slurps up the class directory searching for the class then including it.
-
okay, so here is my question in regards to this autoload script. So let's say my files in my classes folder is hello.class.inc and my class is defined as class Hello{ //some code here } So I noticed in a file where I call upon class such as $var = new Hello(); I would get an error saying "Hello.class.php" doesn't exist but if I rename the class with a capital H in Hello.class.php it will work. So what is going on here that causes that? <?php spl_autoload_register('myAutoLoader'); function myAutoloader ($className){ $url = $SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; if(strpos($url, 'includes' ) !== false) { $path = '../classes/'; } else { $path = 'classes/'; } $extension = '.class.php'; require_once $path . $className . $extension; } ?>
-
trying to insert multple form data into msyql database
jcarney1987 replied to jcarney1987's topic in PHP Coding Help
Any recommendations on a way to quickly learn it in terms of quality sources? When you say javascript, I'm assuming you mean jquery or ajax. I'm still pretty new to the web development, so I'm learning the hard way. -
trying to insert multple form data into msyql database
jcarney1987 replied to jcarney1987's topic in PHP Coding Help
Thanks everyone for the input. I looks like I need for a rewrite on most of my stuff, but I'm learning. I found a quick solution that solved my problem by changing my test to if(!empty ($_POST['item_number$count'])). I will go back and work with some of the other methods as I think the code will be cleaner that way. Thanks again for the help -
trying to insert multple form data into msyql database
jcarney1987 posted a topic in PHP Coding Help
So I'm basically trying to make a simple Purchase Order program and I have HTML like this. Now my problem is when i do something like if(isset($_POST['item_number'.$count])) it will always return $count number even if item_number isn't set. So what would be better way of sending this data via post to get it into mysql database. $num_rows=10; $count=0; while($num_rows > 0){ echo "<tr>"; echo '<td><input class="item" name="item_number'.$count.'"></td>'; echo ' <td><input class="description" name="description'.$count.'"> </td>'; echo '<td><input class="quantity" name="quantity'.$count.'"></td>'; echo '<td><input class="unit_price" name="unit_price'.$count.'"></td>'; echo '<td><input class="total_price"></td>'; echo '</tr>'; $count++; $num_rows--; } Thanks! -
So previously I used to manage my own web hosting company, then I took the trade of HVAC and slowly but surely lost my hosting company. Server management I was pretty good at, and I did learn some basic perl to do some very basic things, but with all things not practice I've pretty much lost all my knowledge of programming. So I decided to pick up it all back up and get back into the industry and learn PHP instead because well let's face it. Right now it integrates easier. I hate though how lazy the code can be written. So you might see me time or 2 here, and who knows, maybe we can be friends