Jump to content

littlened

Members
  • Posts

    34
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

littlened's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks again for the reply. I'd never heard of Jade, Coffee Script or LESS until you mentioned them in your original post, I'll have a read up on them. I only use SVN for the main development version of my CMS, mainly because I simply perform an export of the CMS for each project and modify each one to suite the functionality requested by the client. I find having an SVN for all projects difficult to manage if I'm honest, and many of the websites we develop are for small businesses and not really business critical. Most of what we do is for marketing agencies who don't have the skill in-house, so if we had a repository for each website we created, we'd literally have hundred and hundreds, many of which we might never work on again. It seems that when it comes to actual application development in PHP, there's a fair bit I don't seem to know, much of which seems overkill for the work we do at the minute. However, next year we'd like to target more application driven projects, so I'm certainly going to have to get a book specifically for development PHP applications rather than PHP websites.
  2. I had another ready of your original thread, and to be honest there isn't anything that PHPStorm provides that really jumps out and gives me a reason to use want to use it. Most of my projects I create initially from an export of an SVN repository (my CMS). So having it create templates when I create a new project isn't a big one for me. Dreamweaver can be set to auto-upload files to your FTP when you create then, and you can setup multiple servers per project/site (i.e. development, production). Dreamweaver CS6 has a live view feature, and an element inspector. I'll checkout chromePHP though, it looks useful.
  3. Thanks, that was very informative. I did try PHPStorm, but the thing that put me off was it didn't seem to pickup your class names from your stylesheets, which although isn't major, is a basic thing that I like. One thing I noticed about Netbeans that I didn't mention before. You can't seem to create new folders within a PHP project? Or if you can it's not obvious how you do it.
  4. Not sure i've put this in the correct forum, but it's the only suitable match I could find. I've been working with HTML/CSS for about 16 year, and PHP for around 10 year. During that time my main editor has always been Dreamweaver. I've never really used design view, I've just always liked it because of the FTP integration, being able to copy files within the application, and the ability to just drag and drop images into HTML/CSS documents and it auto formats the path to the image for you. My version of Dreamweaver is getting out of date, so I've started looking at other software that I could use to perform my tasks. The first I tried was Aptana Studio. I used it for a while and I found it was ok, the CSS auto-complete wasn't as good and it didn't have the ability to drag images into your code and it create the paths for them. On the PHP site it was great, it knew all my class names and made coding in PHP slightly easier. I could setup each project to auto-upload to FTP, which was good but not as simple to setup as Dreamweaver. SVN integration was good too, but again setup is a bit long winded. I eventually stopped using is when I got sick of it being slow. I didn't both trying Zend Studio or Eclipse as I just assumed they'd be roughly the same. I came across Coda, which being a Mac user I found it had a much more attractive interface, and setup of projects was very easy. I used it for a couple of month. The PHP side of things wasn't that great, nowhere near the standard of Dreamweaver or Aptana. It had the ability to simply drag an image into your code, which I always find handy. But again, at times I found it running slow, and the auto-complete in CSS wasn't as good as Dreamweaver. Coda also has this great feature where you can install an app on your iPad, and you can see the results of your HTML/CSS as you're working on it. More recently I've looked at NetBeans, which again seems very capable when it comes to the coding site of things. But the HTML/CSS side doesn't seem that great. Again, you can't just drag images into your code. A couple of days ago I downloaded a trial version of Dreamweaver CS6, and it seems to meet my needs perfectly. FTP integration, I can setup multiple FTP account for a project (development/production), copy and paste files within a project. The HTML/CSS coding aspect of it is by far the best of all the applications in my option, and the PHP side, although not fantastic is still very good. The new live view is handy too. My concern is that because I've used Dreamweaver for so long I'm missing out on some of the great features of some of the other applications out there, just at the moment, having never really used or understood those features I've never missed them. There's also the stigma that seems to be attached to developers who use Dreamweaver. I've considered using two applications, Dreamweaver for frontend stuff, and maybe Aptana (or similar) for the PHP side, but if I can I'd rather stick with one application (Dreamweaver isn't cheap), as setting up two projects in two applications along with the SVN and FTP details can be a little time consuming. Especially when many of my projects only last a week or so and few are very long term projects. There's also the fact that once a site it ready to go live, I have to go back through and change all the FTP details for the project. To give you an idea, most of the stuff I do is creating HTML/CSS and integrating it into my own CMS. I can go through periods where I'm doing more HTML than PHP, but then other times I can be doing more PHP than HTML. So really I need an application that strikes a nice balance between the working with the two. So, the point of my thread is, as a long term Dreamweaver user, what (if any) features am I missing out on? I know other IDE's have built in debugging etc, but I've never really been a fan of running projects locally on the machine, I prefer to have a web based development server which allows me to work on projects from both the office and home. When I do debugging on a project I generally just output variables on the screen, do any of the IDE's have the ability to show you the values of variables at certain points through the executing process? Does anyone still use Dreamweaver these days, or is a more a frontend development tool?
  5. If it helps. I tend to have the header/footer etc as includes, and any other little bits. What I do then is have a php file for each page. So say I have a page which lists products, I would have a page which has the look of the page in it, and right at the top it would include a php file like 'php/php_productlist.php'. If I had db content in the header, I would have a file called 'php/php_footer.php' which would be includes in the file 'inc/inc_footer.php'. I find doing it this way helps to separate content from code, creating a sort of code behind page. My folder structure usually looks like... > classes - for any class files cls_db.php > css - for css files i.e. css_mysite.css > inc - for include files i.e. inc_header.php > php - for PHP files i.e. php_productlist.php > images - images obviously here's a brief example. productlist.php <?php include('php/php_productlist.php'); ?> <html> <head> </head> <body> <?php include('inc/inc_header.php'); ?> <h1>My page title</h1> <p>you can echo out values set in the file 'php/php_productlist.php' in here</p> <?php include('inc/inc_footer.php'); ?> </body> </html> php/php_productlist.php <?php // get a list of products from the database and store it in an array ?> inc/inc_header.php - again you can you can put PHP code in an include file for the header as well <?php include('php/php_header.php'); ?> <h2>Welcome to my site</h2> <img src="mylogo.png" />
  6. Thanks, it's nice to hear someone agrees with me. I just cant get it into my head why people would do it that way, it's so messy and come the end of the project there could could be hundreds of extra lines of code for PHP to parse because of all the echo's.
  7. -------------------------------------------------------------------------------- I've been building websites for about 10 year now, and generally when I do, I tend to keep as much HTML out of the PHP as I can. i.e., if I wanted to loop through an array and generate a list item I would... <html> <title>Title in here</title> <head> </head> <body> <h1>A list of stuff</h1> <select name="list"> <?php $listArray = array('item1','item2','item3','item4'); foreach ($listArray as $listArray) { ?> <option><?= $listArray['title']; ?></option> <?php } // END foreach ?> </select> </body> </html> Recently I've been working on a project which involved working on someone elses code, and I've found the whole thing absolutely terrible to work with. This guy seems to put as much HTML as possible within PHP code....like this.... <html> <title>Title in here</title> <head> </head> <body> <?php echo "<h1>A list of stuff</h1>"; echo "<select name=\"list\">"; $listArray = array('item1','item2','item3','item4'); foreach ($listArray as $listArray) { echo "<option><?= $listArray['title']; ?></option>"; } // END foreach echo "</select>"; ?> </body> </html> So I'm wondering, is it perfectly normal, which way is best? I find my way easy because when I look at a layout in Dreamweaver, I can see where the list item is in a div or table. If I had a list item in a table, I could clearly see it, but this other guy would put the list item and the table inside php echo's. Am I right in thinking that it's unnecessary php code for PHP to parse? Or is there some major benefit in doing it the other guys way.
  8. I've not seen your code so I may be off the mark here, but... <?php if ($page > 1) echo "<img src='backbutton.gif;>"; ?> and for the forward button you should count the number of results. <?php if ($page < $maxresults) echo "<img src='forward.gif'>"; ?> this is how I do it [code] // Determine page and SQL limit $results_max = 10; if (!isset($_REQUEST['page'])) { $page = 1; } else { $page = $_REQUEST['page']; } $results_from = (($page * $results_max) - $results_max); // Count total number of results $results_total = 0; $sql = "SELECT * FROM DB"; $sql_result = mysql_query($sql_count,$database) or die(mysql_error()); while ($row = mysql_fetch_array($sql_result)) { $results_total++; } // Calculate the number of pages $results_pages = ceil($results_total / $results_max); // Get actual results $rc = 0; $sql = $SELECT * FROM DB"; $sql_result = mysql_query($sql,$database) or die(mysql_error()); while ($row = mysql_fetch_array($sql_result)) { $re_list[$rc]['DeptAir'] = get_airport_location($row['OfferDeptAir']); $re_list[$rc]['ArrAir'] = get_airport_location($row['OfferArrAir']); $re_list[$rc]['Hotel'] = get_hotel_desc($row['HotelID']); if ($row['HotelID'] == 0) $re_list[$rc]['Hotel'] = 'Accommodation on arrival or n/k'; $re_list[$rc]['Board'] = get_board_desc($row['OfferBB']); $re_list[$rc]['ID'] = $row['OfferID']; $re_list[$rc]['DeptDate'] = $row['OfferDeptDate']; list($year, $month, $day) = split('[/.-]', $re_list[$rc]['DeptDate']); $re_list[$rc]['DeptDate'] = $day."-".$month."-".$year; $re_list[$rc]['Company'] = $row['ClientCompany']; $re_list[$rc]['URL'] = $row['ProfileURL']; $re_list[$rc]['Sharing'] = $row['OfferSharing']; $re_list[$rc]['Class'] = $row['OfferClass']; $re_list[$rc]['TotalCost'] = $row['OfferTOD'] + $row['OfferFuel'] + $row['OfferTax'] + $row['OfferPrice'] + $row['OfferBFee']; $re_list[$rc]['Resort'] = $row['OfferResort']; $rc++; } [/code] then when it comes to displaying the page numbers. [code] <?php $p = 1; while ($p < $results_pages OR $p == $results_pages) { ?>   [ <a href="offer_search_results.php?page=<?= $p.$page_link; ?>"><?= $p; ?></a> ]   <?php $p++; } // END PAGE WHILE?> [/code] Though my solutions doesnt give you a back and forward button, but instead a list of pages. but the code should give you an idea.
  9. a quick google found this link http://adamv.com/dev/articles/iis-on-xp-home An easier way in my opinion is to install LAMP, http://www.apachefriends.org/en/xampp-windows.html It will install apache, php, mysql as well as other stuff, and its so easy.
  10. I'm putting together a CMS for a client, and want to place a link in the CMS to webalizer which comes with cpanel. I can link to webalizer but it'll ask for a username and password, I would like to be able to store the username and password for webalizer (cpanel) in a database and have this passed in the link so that webalizer doesnt ask for a password. Sorry, just checked, its awstats that cpanel uses.
  11. [quote] class categories { var $db; function categories() { include 'classes/cls_db.php';       $this->db = new DB(); } function get_categories() { $query = "SELECT Category_ID,Category_Name,Category_Display FROM Categories ORDER BY Category_Name ASC ";       $result = mysql_query($query, $this->db->conn) or die("Error with query:<br /><pre>{$query}</pre><br /><br >" . mysql_error()); $num_rows = mysql_num_rows($result); while ($row = mysql_fetch_array($result)) { $categories[] = $row; } return $categories; } } [/quote] thats one class which uses the DB connection, then also have another class which I've tried to do in exactly the same way, however when I include 2 classes in a php file where both classes need to use the DB class, I get an error about not being able to initiate the class because it's already been done, so obviously I can't create the DB class twice. So what I need is a way to create the db class from a php file, then include 2 classes which can access the connection setup in the db class, without having to try and create 2 instances of the db class. hope that makes sense.
  12. this is the error, it says error with queyr, but to me the query seems fine and the products table does exist, so I assume its the connection Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/alive/public_html/clients/zund/www/manager/classes/cls_products.php on line 13 Error with query: SELECT * FROM Products
  13. this is a class I have to initial a db connection [code]class DB {     var $host = 'localhost';     var $user = 'dsfsdfsd';     var $pass = 'dfsdf';     var $dbase = 'dfsdfsdf'; var $conn;     function DB()     {         $this->connect();     }     function connect()     {         $this->conn = mysql_connect($this->host, $this->user, $this->pass);         mysql_select_db($this->dbase, $this->conn);     } }[/code] How can I use this class to create the db connection at the beginning of a php file, and then use the same connection inside functions within other classes? I tried initiating the DB connection from within each class, but now I've reached a point where I am including 2 classes in a php file and both classes are trying to create an object from the DB class and php wont allow it.
  14. yes you were right, problem with my query, thanks
  15. ok so I've modified the code to this, but now I get the following errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/alive/public_html/clients/zund/www/manager/classes/cls_categories.php on line 16 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/alive/public_html/clients/zund/www/manager/classes/cls_categories.php on line 17 [code] class categories { function categories() { } // end categories function function get_categories() { include 'classes/cls_db.php';       $db = new DB(); $categories = array(); $query = "SELECT Category_ID,Category_Name,Category_Display FROM Categories ORDER BY Category_Name ASC ";                    $result = mysql_query($query, $db->conn); $num_rows = mysql_num_rows($result); while ($row = mysql_fetch_array($result)) { $categories[] = $row; } return $categories; } // end get_cats function } // END CLASS [/code]
×
×
  • 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.