Jump to content

benoit1980

Members
  • Content Count

    35
  • Joined

  • Last visited

Community Reputation

0 Neutral

About benoit1980

  • Rank
    Member
  1. benoit1980

    Best way of organizing dropdown menus please

    I also tried another way as below(pure javascript) but I have a problem, I cannot get the bootstrap drop down menu staying aligned when it opens in a bootstrap column. Any idea why please? Thanks, Ben <!DOCTYPE html><html lang="en"> <head> <meta content="width=device-width, initial-scale=1.0" name="viewport" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <style>.no-display { display:none; position:absolute; top:50px;}.btn-group { margin: 0 auto; text-align: center; font-size:0 !important;}.btn-group a { display:inline-block;}</style> <br><br><br><br> <div class="container text-center extra_pages_text_black"><div class="row clearfix"><div class="col-md-12 column"> <div class="row clearfix"><div class="col-md-12 column"><h2>Choose</h2></div></div><br><br><div class="row clearfix"><div class="col-md-5 column"><a href="#" id="button1" class="btn btn-lg btn-success">BUTTON1</a></div><div class="col-md-2 column"><h2>OR</h2></div><div class="col-md-5 column"><a href="#" id="button2" class="btn btn-lg btn-success">BUTTON2</a></div></div> <div class="row clearfix" id="eatin_takeaway_drop"> <div class="col-md-12 column"> <div class="dropdown"> <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="false"> Dropdown <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1"> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li><li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li><li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li><li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li><li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li><li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li><li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li> </ul></div> </div></div><div class="row clearfix" id="delivery_drop"><div class="col-md-12 column">THIS IS THE RESULT OF BUTTON2</div></div></div></div></div> <script>$("#button1").on('click', function() { $("#eatin_takeaway_drop").fadeIn(); $("#delivery_drop").fadeOut();}); $("#button2").on('click', function() { $("#eatin_takeaway_drop").fadeOut(); $("#delivery_drop").fadeIn();}); </script> <!-- //CONTACTS --> <br><br><br><br> <br><br><br><br> <script src="../js/jquery/jquery-1.11.1.js"></script>
  2. benoit1980

    Best way of organizing dropdown menus please

    Ok, I have found an example here: http://jsfiddle.net/EhtrR/1135/ And tried to make my own using bootstrap but all I see are my buttons and nothing else, the js is not showing or hidding the code in my div, any idea why please? Thanks <head> <script src="../js/jquery/jquery-1.11.1.js"></script><style>.no-display { display:none; position:absolute; top:50px;}</style></head> <script>$("#button1").on('click', function() { $("#eatin_takeaway_drop").fadeIn(); $("#delivery_drop").fadeOut();}); $("#button2").on('click', function() { $("#eatin_takeaway_drop").fadeOut(); $("#delivery_drop").fadeIn();}); </script> <br><br><br><br> <div class="container"><div class="row clearfix"><div class="col-md-12 column"><div class="row clearfix"><div class="col-md-6 column"><a href="#" id="button1" class="btn btn-lg btn-success">EAT IN / TAKE AWAY</a></div><div class="col-md-6 column"><a href="#" id="button2" class="btn btn-lg btn-success">DELIVERY</a></div></div><div class="row clearfix"><div class="col-md-12 column no-display" id="eatin_takeaway_drop">HI THIS IS THE RESULT OF BUTTON1</div></div><div class="row clearfix"><div class="col-md-12 column no-display" id="delivery_drop">HI THIS IS THE RESULT OF BUTTON2</div></div></div></div></div> Where did I do wrong? Any idea please? Thank you, Ben
  3. benoit1980

    Best way of organizing dropdown menus please

    Hi, Thank for the reply, would you have an example of showing hiding the Div based on what is chosen in the drop down menu please? Also for the towns, do I need to use a switch case? Thank you, Ben
  4. Hi Everyone, Someone is asking me a bit of help on a website, I know a bit php and HTML5, I would like to know what would be the best of doing this please: 1)I need to create 2 big buttons, according to the choice of the buttons a different dropbox menu with towns will showup. 2)When the user chooses one of the town, in any drop down, I would like to show a different DIV with content in it. Here is a practical example: BUTTON A BUTTON B if Button A is pressed, show dropdown menu A if BUTTON B is pressed, show dropdown menu B If town 1 from dropdown menu A is chosen show DIV 1 If town 2 from dropdown menu A is chosen show DIV 1 If town 3 from dropdown menu A is chosen show DIV 2 If town 4 from dropdown menu A is chosen show DIV 3 If town 5 from dropdown menu A is chosen show DIV 1 If town 1 from dropdown menu B is chosen show DIV 6 If town 2 from dropdown menu B is chosen show DIV 5 If town 3 from dropdown menu B is chosen show DIV 5 If town 4 from dropdown menu B is chosen show DIV 6 If town 5 from dropdown menu B is chosen show DIV 4 How to do this without reloading the page please? Thank you, Bambinou
  5. benoit1980

    CSS over https problem

    Hello, I cannot work out this one. I am loading a css file on an https page as: <link rel="stylesheet" type="text/css" href="/assets/fa687e60/jui/css/base/jquery-ui.css" /> But using the chrome element tool I see this error: The page at 'https://mysite.com/deal/create' was loaded over HTTPS, but displayed insecure content from 'http://mysite.com/css/images/ui-bg_glass_55_fbf9ee_1x400.png': this content should also be loaded over HTTPS. Now I went in the css file and the code is like that: .ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1;background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x;color: #363636;} All my images are loading that way and it seems to be causing problems on all my https pages, any idea how to fix this please? Thank you, Ben
  6. Hello, I am having a real problem with this and would like to know if someone can give me a feedback. Thank you I am developing a website and would like to only let the access to a few people. I try to lock the website with an "allow" and "disallow" htaccess block but it seems to be slowing down the website a lot. The website at the moment is hard coded with https:// I am wodering if the .htaccess is correct. Sometime the pages load non stop and nothing shows up and sometime the pages are showing up. I remove the htaccess, everything is fine. here is the code: <Limit GET POST> order allow,deny allow from 89.187.79.200 #The next line modified by DenyIP #deny from all </Limit> Options +FollowSymLinks IndexIgnore */* RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] <Files 403.shtml> order deny,allow deny from all </Files> allow from xxx.xx.xx.xxx ###########FaceBook########### Allow from 31.13.24.0/21 Allow from 31.13.64.0/18 Allow from 66.220.144.0/20 Allow from 69.63.176.0/20 Allow from 69.171.224.0/19 Allow from 74.119.76.0/22 Allow from 103.4.96.0/22 Allow from 173.252.64.0/18 Allow from 204.15.20.0/22 Allow from 2401:db00::/32 Allow from 2620:0:1c00::/40 Allow from 2a03:2880::/32 ##########FaceBook############ Thanks in advance Ben
  7. benoit1980

    Forom with 1 image upload using PDO - No luck.

    Thanks Jacques! I will give it a shot now to see how it works:-)) Your help is much appreciated! Ben
  8. benoit1980

    Forom with 1 image upload using PDO - No luck.

    Thank you so much jacques!!! I cannot believe I missed that one, it is because I change the row name in the database and totally forgot about it...dang! I am still on my beginner courses so mistakes will still be made for many years :-) What I would like to ask you please is to tell me if my way of storing the url path is correct or right for a coder, at the moment it is saving fine, I have added a bit of code on the $path. In the database it saved my picture as "uploads/10566448_749876155095516_711706263_n.jpg" Perhaps I should add a random generated function that gives different picture names each time? I am not sure if I am going in the right direction to be honest.... <?php include "../common/header_admin.php"; ?> <?php include '../conn/db_connect.php'; ?> <!-- Navigation --> <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> </button> <a class="navbar-brand" href="index.html">PizzaByLuca.com</a> </div> <!-- /.navbar-header --> <ul class="nav navbar-top-links navbar-right"> <!-- /.dropdown --> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#"> <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i> </a> <?php include '../admin/login_area.php'; ?> </li> </ul> <!--Left Side Navigation Menu Starts--> <div class="navbar-default sidebar" role="navigation"> <div class="sidebar-nav navbar-collapse"> <ul class="nav" id="side-menu"> <li class="sidebar-search"> <div class="input-group custom-search-form"> <input type="text" class="form-control" placeholder="Search..."> <span class="input-group-btn"> <button class="btn btn-default" type="button"> <i class="fa fa-search"></i> </button> </span> </div> </li> <li> <a class="active" href="#"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a> </li> <!--Menu Include Starts --> <?php include '../admin/left_side_menus.php'; ?> <!--Menu Include Ends --> </ul> </div> </div><!--Left Side Navigation Menu End--> </nav> <div id="page-wrapper"> <div class="row"> <div class="col-lg-12"> <h1 class="page-header"></h1> </div> </div> <!--Content Here--><?php$action = isset( $_POST['action'] ) ? $_POST['action'] : ""; if($action == "create"){ try{$query = "INSERT INTO top_picture_slider SET title = ?, desc_medium = ?, desc_small = ?, image = ?"; $path = "uploads/" . $_FILES['image']['name']; move_uploaded_file($_FILES['image']['tmp_name'], "../".$path); $title = sanitize($_POST['title']); $desc_medium = sanitize($_POST['desc_medium']); $desc_small = sanitize($_POST['desc_small']); $image = $path; //prepare query for execution $stmt = $con->prepare($query); //this is the first question mark $stmt->bindParam(1, $_POST['title']); //this is the second question mark $stmt->bindParam(2, $_POST['desc_medium']); //this is the third question mark $stmt->bindParam(3, $_POST['desc_small']); //this is the fourth question mark $stmt->bindParam(4, $image); // Execute the query if($stmt->execute()){ echo "<div class='alert alert-success' role='alert'>Record was added!.</div>"; }else{ die("<div class='alert alert-danger' role='alert'>Unable to update record!</div>"); } }catch(PDOException $exception){ //to handle error echo "Error: " . $exception->getMessage(); }}?> <!--we have our html form here where user information will be entered--><form action="#" method="post" enctype="multipart/form-data"><input type="hidden" name="MAX_FILE_SIZE" value="100000" /><input type="text" class="form-control" placeholder="Add Your Title" size="100" name="title" /><br /><br /><textarea cols="50" class="form-control" rows="10" wrap="virtual" maxlength="150" placeholder="Add Your Medium Description" name="desc_medium"></textarea><br /><br /><textarea cols="50" class="form-control" rows="10" wrap="virtual" maxlength="100" placeholder="Add Your Small Description" name="desc_small"></textarea><br /><br /><input type="file" name="image" class="btn btn-default btn-lg" /><br /><br /><input type="hidden" name="action" value="create" /><input class="btn btn-primary btn-lg" type="submit" value="save" /><br /><br /></form> <!--Content Here--> <?php include '../common/footer_admin.php'; ?> Thanks, Ben
  9. Hello everyone, I would like to upload an image to a directory and keep it's path saved in mysql. Some people proposed me in the past to save the image directly in mysql but others were totally against it. Here is my code, remember, it is connecting properly and at the moment what I receive in the "image" row of mysql is "uploads/" but no image name at all. Don't worry about the form validation as of yet, I am just trying to understand the principle at the moment, I will do the form validation later on. Thanks in advance for your help.(I did not include the connection file as it is connecting well) The error I am also currently receiving is: Error: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'image' cannot be null <?php include "../common/header_admin.php"; ?> <?php include '../conn/db_connect.php'; ?> <!-- Navigation --> <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> </button> <a class="navbar-brand" href="index.html">PizzaByLuca.com</a> </div> <!-- /.navbar-header --> <ul class="nav navbar-top-links navbar-right"> <!-- /.dropdown --> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#"> <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i> </a> <?php include '../admin/login_area.php'; ?> </li> </ul> <!--Left Side Navigation Menu Starts--> <div class="navbar-default sidebar" role="navigation"> <div class="sidebar-nav navbar-collapse"> <ul class="nav" id="side-menu"> <li class="sidebar-search"> <div class="input-group custom-search-form"> <input type="text" class="form-control" placeholder="Search..."> <span class="input-group-btn"> <button class="btn btn-default" type="button"> <i class="fa fa-search"></i> </button> </span> </div> </li> <li> <a class="active" href="#"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a> </li> <!--Menu Include Starts --> <?php include '../admin/left_side_menus.php'; ?> <!--Menu Include Ends --> </ul> </div> </div> <!--Left Side Navigation Menu End--> </nav> <div id="page-wrapper"> <div class="row"> <div class="col-lg-12"> <h1 class="page-header"></h1> </div> </div> <!--Content Here--> <?php $action = isset( $_POST['action'] ) ? $_POST['action'] : ""; if($action == "create"){ try{ $query = "INSERT INTO top_picture_slider SET title = ?, desc_medium = ?, desc_small = ?, image = ?"; $title = sanitize($_POST['title']); $desc_medium = sanitize($_POST['desc_medium']); $desc_small = sanitize($_POST['desc_small']); $image = $_FILES["file"]["name"]; //prepare query for execution $stmt = $con->prepare($query); //this is the first question mark $stmt->bindParam(1, $_POST['title']); //this is the second question mark $stmt->bindParam(2, $_POST['desc_medium']); //this is the third question mark $stmt->bindParam(3, $_POST['desc_small']); //this is the fourth question mark $stmt->bindParam(4, $_FILES["file"]["name"]); // Execute the query if($stmt->execute()){ echo "<div class='alert alert-success' role='alert'>Record was added!.</div>"; }else{ die("<div class='alert alert-danger' role='alert'>Unable to update record!</div>"); } }catch(PDOException $exception){ //to handle error echo "Error: " . $exception->getMessage(); } } ?> <!--we have our html form here where user information will be entered--> <form action="#" method="post" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> <input type="text" class="form-control" placeholder="Add Your Title" size="100" name="title" /><br /><br /> <textarea cols="50" class="form-control" rows="10" wrap="virtual" maxlength="150" placeholder="Add Your Medium Description" name="desc_medium"></textarea><br /><br /> <textarea cols="50" class="form-control" rows="10" wrap="virtual" maxlength="100" placeholder="Add Your Small Description" name="desc_small"></textarea><br /><br /> <input type="file" name="image" class="btn btn-default btn-lg" /><br /><br /> <input type="hidden" name="action" value="create" /> <input class="btn btn-primary btn-lg" type="submit" value="save" /><br /><br /> </form> <!--Content Here--> <?php include '../common/footer_admin.php'; ?>
  10. benoit1980

    How to disable https for a few urls?

    Thank you , I will check this later on. The reason I must disable https for this particular page is because I am using an affiliate that shows hotels people can book. For the affiliate to work I had to point the CNAME of a subdomain they asked me to create as: hotels.mysite.com to --> Affiliate.hotels.com Now imagine that this sub points to the subdomain and the user cannot see anything else in the browser rather than hotels.mysite.com. The next problem was to incorporate this hotel searchin the framework to fit with the rest of the rest, I was force to use an iframe but as you know, the iframe will be outputting an http url inside a site that is fully https. Due to this problem, the iframe shows a blankpage....... I hope you understand. Regards, Ben
  11. benoit1980

    How to disable https for a few urls?

    Thanks for your help. Actually the /hotels link is not a folder but the way the framework output the page. I am using the Yii framework. How to do it without folder please? Thank you, Ben
  12. Hi Everyone, I am really struggling with this.....Cannot find a solution anywhere. I have a website with SSL installed. I would like to force SSL on the whole website but not on 2 urls. If my whole site is https://mysite.com and the 2 urls to disable from the SSL are: http://mysite.com/hotels http://mysite.com/weather How can I do it via htaccess please? Thank you so much, Ben
  13. Hi all, Any idea what Pinterest uses to make the background move please? I searched everywhere and cannot find the answer: https://www.pinterest.com/ I need the same type of background movement + popup on my site, it looks so nice! Thank you, Ben
  14. Hi All, I would like to know if someone could help me with this, I have been struggling for days and cannot find an answer. I am new to OOP and still struggle a bit with the logic. I have installed Yii2 on my local machine, all I want is insert a date in the correct format in the database as: DD/MM/YYYY I cannot believe how hard it is just ti work this one out as a beginner....... I tried this: http://www.yiiframework.com/doc-2.0/guide-behaviors.html: And added this code inmy Posts Model: use yii\behaviors\TimestampBehavior; class User extends ActiveRecord { // ... public function behaviors() { return [ 'timestamp' => [ 'class' => TimestampBehavior::className(), 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at', ], ], ]; } } I have the corresponding database fields as created_at and updated_at set as INT. Unfortunately, when I try to save my form I get this error: PHP Fatal Error – yii\base\ErrorException Class 'app\models\ActiveRecord' not found1. in C:\wamp\www\yii2\models\posts.php at line 61 } public function behaviors() { return [ 'timestamp' => [ 'class' => TimestampBehavior::className(), 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at', ], ], ]; } } Any idea why please?I have followed the Yii website tutorial correctly but still cannot get the date input to work. Thank you, Regards, Ben
  15. benoit1980

    PHP OOP scope help please

    Hi everyone, I am starting to learn PHP OOP and would like to know if you could help me understanding the scopes a little bit better. I have created the below code during my courses, but cannot work out how to reuse $this->total in another class. I have set the $total; to protected and was wishing to be able to use it in my second class but it returned an error. Any idea how I could use this variable in another class while set with the scope of Protected please? Thank you so much! Class Calculator{ public $number1; public $number2; protected $total; function setNumber1($int){ $this->number1 = (int) $int; } function setNumber2($int){ $this->number2 = (int) $int; } function Calculate(){ $this->total = $this->number1 + $this->number2; } function getResult(){ return $this->total; } } $Calculator = new Calculator(); $Calculator->setNumber1(5); $Calculator->setNumber2(10); $Calculator->Calculate(); echo $Calculator->getResult() . "<br>"; Class secondCalculator extends Calculator { $this->total = $this->number3 + $this->number4; } Ben
×

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.