Jump to content

denno020

Members
  • Posts

    761
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by denno020

  1. I have used jQuery Form Plugin for this purpose before. It works well. http://malsup.com/jquery/form/#getting-started Denno
  2. Ahh yes, the non-attendees, I forgot about them..
  3. If I were to create database tables for this kind of thing, I would create 3 tables. People table - containing information about the People who attend the meetings; name, phone, any other info Meeting table - which will contain the date of a meeting, maybe some meeting notes or something Attendance table - which will contain 3 fields, ID (auto-generated, primary key), people_id, meeting_id. So for every person who attends, put their ID into a row, along with the ID of the meeting they attended. Then in PHP, you can perform queries with joins to join the three tables, and have all information about the meetings and who attended, at your disposal, to display on your page however you like. I'm not sure how that fits with the Normalisation that was suggested earlier, but I think it would be a fairly simple and effective way to store the information. Hope that helps Denno
  4. Oops! I didn't even think..
  5. I learnt PHP using YouTube. Specifically, from Adam Khoury (aka Flashbuilding). I strongly suggest you check out his videos at http://www.youtube.com/channel/UCpzRDg0orQBZFBPzeXm1yNg. I'm sure there would be links to his website on his YouTube channel. Better than a uni course (I have completed uni so I can compare), and it was free! Denno
  6. The way I would do it is as follows: Loop through all email addresses, matching the domain name for each, and using that as a key in an array... actually it'll just be easier if I show you code $emailAddresses = array() //This is the email addresses you have to start with, it will hopefully be an array. If it's a string, use explode() to get it into an array $sortedEmails = array(); //Will store the sorted email addresses foreach ($emailAddresses as $emailAddy) { preg_match("/.*@(.*)$/", $emailAddy, $matches); $domain = $matches[1]; if (!isset($sortedEmails[$domain])) { //If the domain doesn't already have it's own array, create it $sortedEmails[$domain] = array(); } $sortedEmails[$domain][] = $emailAddy; //Add the email address to the end of the array for the domain } //Pick random email foreach ($sortedEmails as $domain) { echo $domain[rand(0, count($domain)-1]; //Pick a random number between 0 and the size of the array minus 1, which will effectively be a random index } Hopefully that helps. Denno
  7. You could possibly remove it by just using a preg_replace. $table = preg_replace("~.*<ul><li><a href='/'>Parent Directory</a></li>(.*)</ul>.*~" ,"\${1}", $content); I have no idea if that will work, I haven't tested it, but the theory is that it will match all text between the end of the first <li> to the start of the </ul> closing tag, and then put that into the $table variable. The other stuff will effectively be removed. Hopefully it gives you an idea Denno
  8. You don't close the opening <a> tag with the '>' symbol $banner_location = "http://".$_SERVER['SERVER_NAME']."/images/".$page_language.".png" <a href="http://".$_SERVER['SERVER_NAME']."/tilfredshedsgaranti-".$page_language.;</a> should be (also note that the image was moved inside the <a> tags, and into an <img> tag). $banner_location = "<a href=\"http://".$_SERVER['SERVER_NAME']."/tilfredshedsgaranti-".$page_language."><img src=\"http://".$_SERVER['SERVER_NAME']."/images/".$page_language.".png\"/></a>"; //Or with single quotes so you don't have to escape the double quotes: $banner_location = '<a href="http://'.$_SERVER['SERVER_NAME'].'/tilfredshedsgaranti-'.$page_language.'><img src="http://'.$_SERVER['SERVER_NAME'].'/images/'.$page_language.'.png"/></a>'; This is making an assumption as to what you want. Hope that helps Denno
  9. Ok, so what is the significance of the 10? Why are you counting to 10? I really need to know the structure of your webinvt.txt file if I'm going to be able to run any tests myself.. Just putting 'stuff' in there won't work, as you're echoing out array indexes of strings, which means it's only going to grab a single letter, which would actually be a number from the real data I would assume. To be honest, this is really a terrible way to manage your inventory, it's exceptionally clunky and nearly impossible to maintain. I suggest you put your efforts into a writing a script that will parse your webinvt.txt file, and instead of writing it to a html file, save it to a database. You can then use phpmyadmin to manage the values in the database, or you could write your own, very basic, CMS (content management system). But as I said, without knowing what each field in your txt file is supposed to be (they're not going to all be strings), it's incredibly hard for me to give you definitive help, without just throwing guesses at you..
  10. So you have 20 elements on a line? I assume comma separated? As for your <head> tag, the following if part of the HTML that you just pasted before <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>CSV Contents</title> <link rel="stylesheet" type="text/css" href="/css/demo_page.css" /> <link rel="stylesheet" type="text/css" href="/css/demo_table.css" /> <style type="text/css"> <!-- .style5 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; } .style9 {font-size: 12px} .logo h1 {position: absolute; top: 5px; right: 5px; font-size:14px; } .logo img-with-text {float: left; left 5px; font-size:14px; .img-with-text {text-align: justify; width: 40%; height: 20%;} .img-with-text img {display: block; margin: 0 auto;} .search {margin : 0px;} --> </style> <script src="/js/jquery.js"></script> <script src="/js/jquery.dataTables.nightly.js"></script> <script src="/js/makedatatablesworkfunction.js"></script> <div class="img-with-text"> <img src="/csv/image002.png" alt="sometext" /> <p>"WC" is West Coast warehouse- please add approximately 2-3 weeks for the arrival to East Coast.<br><br> </p> </div> <div class="logo"> <br>Last Updated on November 5, 2013, 6:15 pm </h1> </div> </head> <!-- ========================== Notice the ending head tag here ======================== --> <body id="dt_example"> <div id="container"> This is where it needs to be: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>CSV Contents</title> <link rel="stylesheet" type="text/css" href="/css/demo_page.css" /> <link rel="stylesheet" type="text/css" href="/css/demo_table.css" /> <style type="text/css"> <!-- .style5 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; } .style9 {font-size: 12px} .logo h1 {position: absolute; top: 5px; right: 5px; font-size:14px; } .logo img-with-text {float: left; left 5px; font-size:14px; .img-with-text {text-align: justify; width: 40%; height: 20%;} .img-with-text img {display: block; margin: 0 auto;} .search {margin : 0px;} --> </style> <script src="/js/jquery.js"></script> <script src="/js/jquery.dataTables.nightly.js"></script> <script src="/js/makedatatablesworkfunction.js"></script> </head><!-- =========New </head> tag position=============== --> <div class="img-with-text"> <img src="/csv/image002.png" alt="sometext" /> <p>"WC" is West Coast warehouse- please add approximately 2-3 weeks for the arrival to East Coast.<br><br> </p> </div> <div class="logo"> <br>Last Updated on November 5, 2013, 6:15 pm </h1> </div> <!-- =========Old </head> tag position=============== --> <body id="dt_example"> <div id="container">
  11. Ok so I just looked at your first bit of code, as I didn't know what you meant by using the semi-colon for escaping. What you're actually doing is using the semi-colon to end the line for the string input of the html_body variable. To be honest, it's quite hard to follow your code. And also, I hope that that isn't the current HTML output, because you still have divs in the <head> tags. Can you attach your webinvt.txt file so I can actually run the script and see the output myself. Have you considered using a database? It would make this much easier, and I would think much quicker too, as you don't have to handle external files.
  12. Yep you're spot on there. Good Luck
  13. You can put $(document).ready(function () { $('#example').dataTable(); }); anywhere you want. You can put it in script tags in your document header (in between the <head> tags), you can put it in your body in between <script> tags, but ideally you'd have it in an external JS file. If you don't already have an external JS file, I would suggest adding it to the end of your <body> E.g. <!-- Rest of your page --> <script> $(document).ready(function () { $('#example').dataTable(); }); </script> </body> </html> Obviously make sure you give the table a valid id, and use that in place of 'example', and also make sure the datatables script is being imported correctly. Denno
  14. Few things with your code. You have output in the <head> tags. This isn't a header tag, this is for document information, so you should remove the code from the head tags, and place it in either a div with id/class of header, or inside <header> tags that are inside the body tags. You also have an ending </h1> tag, but no opening <h1> tag. There are multiple divs that either aren't opened, or aren't closed. So you're going to need to clean up your code/output a fair bit, and once you've done that, you'll get something like this: http://jsfiddle.net/Gd9QW/ That works with the datatables. It looks terrible, there is no CSS, but it works. Change some of the content in the table cells, and you'll see the sorting work when you click on the column headers. Denno
  15. Mate that's the PHP file. If you copy the source of the webpage, there will be no PHP in it. I just want to look at the finished product, not the script that makes it. I'll look at that later.
  16. Can you actually copy and paste the HTML over from a rendered page? Saves me having to set up the script and get it rendering myself. Just open the page, view the source, then copy and paste it all here.
  17. Just so long as your table that is getting printed out is formatted correctly, then the datatables should still work. Are you able to show me the HTML that is produced when you open this page? If you could copy and paste the whole HTML for the page, we'll work out what's going on. Denno
  18. The easiest way I can think of would be to use DataTables, which is a jQuery plugin.
  19. That's easily fixed by just adding an echo "</div>"; directly after the foreach, with another step of logic to make sure there aren't two ending divs
  20. Something like this will work: $posts = array();//This will be your result set from the database $count = 0; $postCount = count($posts); echo '<div class="container">'; //Open a container foreach($posts as $post){ echo '<div class="comment">'.$post.'</div>'; $count++; $postCount--; if($count == 3){ //Check if 3 posts have been printed echo "</div>"; //close your container div if($postCount > 0){ //Check if there are more posts echo '<div class="container">'; //open a new container } $count = 0; //reset 3-post counter } } Denno
  21. You will need to float the ad and the form so that they can appear on the same line together. Alternatively you could position them using relative/absolute positioning. Denno
  22. You will need to use javascript and ajax. In your javascript, you add an event listener so as soon as a radio button is selected, it will trigger the ajax, which will run your php script and insert the data into your database. Denno
  23. you could use a loop like this: <body> <div class="leftbar"> <?php $count = 0; foreach($results as $img){ count++; echo $img; if(count == 4){ echo ' </div> <div class="maincontent"> <!-- main content of viewed page --> </div> <div class="rightbar"> '; } } ?> </div> </body> It's a little ugly, but it will give you what you want. Basically you just loop through your 8 results, keeping track of how many have been printed, once you've hit 4, print out the end of the left column div, the main content, the start of the right column div, and then let the loop finish. As I said, this isn't the best way to do it, but it's one way. Hope that helps. Denno
  24. What happens if you put session_start() before your session_save_path()? session start is supposed to be the very first line in your file, but not sure if that counts in regards to another session setting. If that's not the problem then you need to look at your login handler, specifically, where you're setting the username session variable. Make sure that's working. Denno
  25. Does anything get output when you do the var_dump? I can see from the character count that it's long, so I wouldn't be surprised if the output is truncated, but I would still expected to see a little bit.. Try print_r, or echo of the $data variable. Then you can use a regex tester like this, http://www.solmetra.com/scripts/regex/, to test your pattern against the data you're trying to match against. Looking at your pattern, that would be the opening div and a tag. Basically you're just trying to get your pattern right, so using the regex tester will help you with that. Denno
×
×
  • 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.