Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. There is no such thing as a "smarty" site. Smarty is simply a library that provides the type of templating and markup that you asked about. It also has nothing to do with joomla. I don't know why you brought that up, but it makes me question whether or not you actually know what it is. I'm not irrationally in love with smarty --- some people love it, some don't. But one of its benefits has always been that it parses the templates into php code and caches these precompiled versions, so you don't have the overhead of reading in templates and doing search and replace on variables. Smarty is used on plenty of big name sites. With that said, it seems that what you really want is some sort of highly customized wysiwig system that hides all the details from the users, yet is ultimately flexible. Sounds like a lot of time and effort would need to be invested to create such a system, and the irony is that on one hand these users are apparently suppossed to be sophisticated enough to drop markup into the middle of templates and reference variables, yet, you describe them as "non-technical."
  2. I'm not sure where you are with your code at this point. The reason your original code did not work, is because php's variable scoping in regards to "global" or "script" scope is a bit unusual. No variables other than the "super globals" are visible inside of functions. So the only way you see a variable in a function is either: a) as a parameter b) a super global ($_ variables as defined by PHP) c) declared to be global INSIDE the function using the "global" keyword. d) Referenced from the $GLOBALS[] superglob array (ie. $GLOBALS['febskip']). Personally you should strive for the design PFMaBiSmAd described, and I'd recommend you pass in the data you need. I also don't see why you would use the .ini file format when it would be easier for you to have a configuration file in a pre-made array format.
  3. Well you're passing the format string 'd-m-Y' as a constant. If you instead passed that as a variable, you could allow it to output however you wanted.
  4. Not to mention that there are already templating engines out there like Smarty that could be dropped in to replace what you have. Yes you'd have to do some conversion of the existing templates but since they are already so incredibly simple, some simple search and replace macros would likely take care of the changes for you. Then you're not reinventing the wheel.
  5. In my experience, the database design is never more than a small fraction of the amount of time it takes to develope the application. If you understand the requirements sufficiently you should be able to get the design mostly right in a short amount of time. I do however find that using a database design tool to be very helpful. For mysql I happen to use dezign for databases, although that has gotten to be rather pricey over the years. It is still inexpensive compared to some of the other commercial tools out there for doing database design.
  6. Please use php tags around your code. Hopefully you actually indent your code blocks. Your existing code assumes a $_SESSION variable 'username' being set. Wherever that code is set, you should also be setting a variable like 'userlevel'. From there, it would be easy enough to modify this script to offer admin links. if (isset($_SESSION['userLevel']) && ($_SESSION['userLevel'] === 1)) { // This is an admin } Just remember that your admin functions should also check this variable. Just because you don't display someone a link, doesn't mean that they might not find out the url to it. Showing or hiding the links is only one part of the problem. For that reason it would probably be good to move this code into a function called isAdmin() or something like that, which you can easily check wherever you need to test whether the person is an admin or not.
  7. Do you understand what the function does?
  8. When people want to pull something off a site that doesn't want to provide that data, often they end up resorting to using fopen() or curl. More often than not, it's curl, because curl has all sorts of features that allow it to look to the website like a normal client. Once you have the webpage data, you can parse it up. As this is frequently a difficult and error prone task depending on the complexity of the markup, the regular expression functions are of particular benefit, because they are able to help greatly with the parsing efforts. Expect to invest significant time looking at the markup they use, and coming up with the regex's that willl allow you to get at the particular data you want.
  9. Please don't create threads like this. I realize you are frustrated, and a big reason for that is your inability to follow up on what people are trying to do for you, rather than actually learning php and mysql yourself. With that said, I posted a question in the 2nd thread, so if you reply to that with the info I need, I will try and straighten you out. I'm locking this thread.
  10. This is kind of a mess. Let's start with your database. What is the table structure that these comments are going to be related to? Please don't say postid, because you have defined that column to be the primary key, and auto_increment.
  11. There's plenty of ways to do it, but this one makes it very easy: https://addons.mozilla.org/en-US/firefox/addon/315 Install it, will require a restart. When you're testing the page, right click on it, and choose "View Page Info." That dialogue will now have a Cookies tab. Click on that for a list of all the current cookies. You can also use the LiveHTTPHeaders, and Firebug addons in different ways to look at the HTTP Headers, which should have the cookies that are being passed in the HTTP header.
  12. Are you seeing a cookie on your machine when testing?
  13. Everything and I do mean everything you need to know to do this in php is in the manual page here: http://us2.php.net/manual/en/features.file-upload.post-method.php In a nutshell: -You need to make an html form that includes the form enctype="multipart/form-data" AND the html element needs to be a type="file". The browser then performs the magic of giving you a widget that ties into the OS and lets you find files. Once the form is submitted, php kicks in and -Puts the information about the uploaded file into a magic superglobal array named $_FILES. -You must then take the temporary name, and use the php move_uploaded_file() function to move the file to it's final destination. That is sometihng you decide, and permissions must allow the file to be written into this location. If there are no errors, the file should now be located and you can then read it back out and display it, assuming the structure is displayable. There is more or less complete source to do this in the manual section I linked.
  14. If you put print_r($_POST); at the top of your process script I'm sure you'll see the problem. This is the code you posted for the "starters"..... echo 'Choose Order' . $options . ''; So it's no surprise to me that there is no $_POST['starter'].
  15. I guess it depends a lot on the nature of the pdf's. Most people have acrobat, so why not use --- ? One solution that I've seen people use is to convert the docs to a flash movie, that includes navigation widgets. Often these will be called "flip books". There's lots of products out there that will convert them, not to mention a few services like issuu and scribd that willl convert and host em for you.
  16. Using some sort of header checking tool like Firebug, open up your page and look at the headers. For latin-1 it should be: Content-Type: text/html; charset=ISO-8859-1. If you want to PM me the url (assuming you don't want to post it) of your site, I can take a look as well. Summary: check the code that emits the http headers for your site. If this is not being set in the header, then I'd expect that the pages would have a header section like: Something tells me that what you actually have is charset=utf-8
  17. I can't 100% guarantee you this will fix your issue, but i can say that the site wants to set a cookie, so you might try adding a cookie jar and see if that stops the runaway redirects.
  18. My suggestion would be to popup a new window for your upload form. Alternatively you could could put it in a div with an iframe, or some variation of same. Then you can just indicate that the upload is complete. Make the window small and design it so it looks like a normal modal dialogue box, and onclick willl just window.close().
  19. Ok, so this is much more promising given the information. Is this an intranet application? From the sound of it, you could simply use $_SERVER['REMOTE_ADDR']. You can get a Mac Id, but that would require javascript calling activex which will only work on IE.
  20. Ok, so just to be clear whenever you read this... I'm not suggesting you change anything about the database. It sucks, and if you could change it that would be great, but I make no assumptions about that. What I meant was you can use the SUM(IF() + IF() + IF()) I described on the 3 columns I listed, if that works ok. My point is, that it is easy, and doesn't require you to cross reference the other varchar columns -- if there's a number in there it will return it and ultimately sum it. The only problem would be that if the application is so poorly written that data gets put into those columns in certain situations where it *shouldn't be added* then you'd need something more complicated, which seems like what you were hinting at earlier. IF so --- If that's true you should be able to do something like IF(IF(LENGTH(preregAB_PRO > 0, true, false), IF(proregAB_PRICE > 0, proregAB_PRICE, 0), 0) + .... But basically this is just a variation on what I originally wrote. FWIW, the attachment you provided has no sub_date column. However, the important thing again, is that IF sub_date is a datetime you'll need to GROUP BY Date(sub_date). Otherwise you'll not get a grouping on day, and basically you'll have a total for every order, which isn't what it seems you want, since it seems you want a total by day.
  21. Ok, so as I stated, your table is "DEFAULT CHARSET=latin1". For all intents and purposes, latin1 = 8859-1. I question that your page is actually setting the charset to be 8859-1. You should probably double check your assumptions. This page might be helpful, in case anything is unclear. http://en.wikipedia.org/wiki/ISO/IEC_8859-1#ISO-8859-1
  22. It could be simple, if in fact it's ok to just add these columns: `proregAB_PRICE` int(6) DEFAULT NULL, `proregCD_PRICE` int(6) DEFAULT NULL, `proregCONF_PRICE` int(6) DEFAULT NULL, I'm guessing this is some sort of conference application, so yeah it looks like that would be safe to do. I don't see a datetime column in the whole table, so not sure where you're getting the date from, unless it requires a join, or this is not the actual table structure. That is truly one ugly non relational table --- you have my condolences.
×
×
  • 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.