Jump to content

Search the Community

Showing results for tags 'class'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

  1. Dear everyone, As a beginner, I continue to have trouble understanding the practical utility of the id-selector. Some arguments I see given in favour of the id-selector are as follows: > Specificity: I understand id-selectors have the highest specificity, which can be useful if one wants to ensure a certain class is not overridden. But I have difficulty imagining a scenario in which this would be a true problem. If a coder overrides his own classes, does this not simply mean his code is not in order? When he overrides his own styling, at least he is alerted he needs to correct his code. In this sense, I cannot see a true utility to the id-selector; it seems but to enable sloppy code, which might produce more complicated problems later on as one's project grows more complex. No offence intended, of course. > Targeting Unique Elements: To my understanding, a given id-selector class can be applied only once to a single instance of an html-element. I don't see a reason why one would not just create a unique class for a respective single element with its own unique and respective styling needs. I can, however, imagine the unique syntax of the id-selector makes it more perceivable and standout in a stylesheet, adding to readability. However, one can easily suggest alternatives such as applying comments, or using comments to categorise a group of classes. I personally cannot see the id-selector's role here to be thus meritorious to warrant its existence. > JavaScript Interaction: JavaScript can work and manipulate ids, but it can manipulate and interact with classes just as easily. Is there truly a difference in what JavaScript can do with ids (in terms of CSS/styling) in comparison to what it can do with classes? I would be most grateful if anyone can show me the practical utility of the id-selector. I continue to feel it has no true practical discerning utility compared to the class-selector, which likely indicates I have simply not understood its role properly. I have had this question for a long time, asked here and there, but could never be truly answered. Sincerely, silverRainfall
  2. I am working with an HTML5 template that supports youtube video backgrounds in a DIV. When I scale the browser window to see how the responsivnes behaves, I notice that the videos crop left/right, top/bottom, depending on the aspect ratio of the DIV. For my purposes, I would need the videos only crop on the right and top only, so that the bottom left is always visible. As I am not a pro I have been doing a lot of trial and error on this, but cannot get it working. I actually need to have two classes available. One where the video scales from the bottom left and one where it scales from the top right corner. I don't quite understand if I need to create two new classes for "videobg" AND "youtube-background" respectively? That would be "videobg-bl, videobg-tr, youtube-background-bl, youtube-background-tr". Or is just one of those classes responsible for the scaling? This is the HTML snippet I use in the template: <div class="imageblock__content videobg col-lg-6 col-md-4 pos-right" data-overlay="0"> <div class="youtube-background" data-video-url="https://www.youtube.com/watch?v=ekthcIHDt3I"></div> <div class="background-image-holder"> <img alt="image" src="img/dancer-1A.png"> </div> </div> and these are the CSS classes for videobg and youtube-background: .videobg { background: #252525; position: relative; overflow: hidden; } .videobg .container, .videobg .background-image-holder { opacity: 0; transition: 0.3s linear; -webkit-transition: 0.3s linear; -moz-transition: 0.3s linear; } .videobg .background-image-holder { opacity: 0 !important; } .videobg.video-active .container { opacity: 1; } .videobg.video-active .loading-indicator { opacity: 0; visibility: hidden; } .videobg video { object-fit: cover; height: 100%; min-width: 100%; position: absolute; top: 0; z-index: 0 !important; left: 0; } @media all and (max-width: 1024px) { .videobg .background-image-holder, .videobg .container { opacity: 1 !important; } .videobg .loading-indicator { display: none; } .videobg video { display: none; } } .youtube-background { position: absolute; height: 100%; width: 100%; top: 0; z-index: 0 !important; } .youtube-background .mb_YTPBar { opacity: 0; height: 0; visibility: hidden; } @media all and (max-width: 1024px) { .youtube-background { display: none; } } Also, the template is using ytplayer.min.js for the youtube backgrounds. Unfortunately, the player shows branding watermarked elements during the first 2-3 seconds of the clip, that I have no idea how to get rid of. I also have all my clips on vimeo, so it would be so much more convenient to be able to use vimeo backgrounds instead. Is there a simple way to do this, without breaking the above CSS?
  3. BACKGROUND: Many moons ago it was suggested that I create a CRON job that would read into a MySQL table the results of a method call to a Matomo API call and thereby speed up the rendering of data for visitors to the Grammar Captive website. I have since come to learn that this technique is called data translation. The following code creates a class object that when inserted into a foreach loop is suppose to fill the properties of the object for further manipulation. Unfortunately it does perform the intended task. THE CLASS class TranslateMatomoAction { public $mysqli_obj; public $visitID; public $type; public $serverTimePretty; public $timestamp; public $url; public $generationTime; public $pageTitle; public $pageID; public $pageView_ID; public $pageID_Action; public $timeSpent; public $eventCategory; public $eventAction; public $eventName; public function __construct($property, $value) { if ($property === 'type') { $this->type = $value; } else if ($property === 'serverTimePretty') { $this->serverTimePretty = $value; } else if ($property === 'timestamp') { $this->timestamp = $value; } else if ($property === 'url') { $this->url = $value; } else if ($property === 'generationTimeMilliseconds') { $this->generationTime = $value; } else if ($property === 'pageTitle') { $this->pageTitle = $value; } else if ($property === 'pageId') { $this->pageID = $value; } else if ($property === 'idpageview') { $this->pageView_ID = $value; } else if ($property === 'pageIdAction') { $this->pageID_Action = $value; } else if ($property === 'timeSpent') { $this->timeSpent = $value; } else if ($property === 'eventCategory') { $this->eventCategory = $value; } else if ($property === 'eventAction') { $this->eventAction = $value; } else if ($property === 'eventName') { $this->eventName = $value; } } public function set_visitID($visitID) { $this->visitID = $visitID; } public function set_mysqli_obj($mysqli_obj) { $this->visitID = $visitID; } } THE INSERTED CLASS AND ASSOCIATED CODE if (is_array($value1) && ($key1 === 'actionDetails')) { foreach($value1 as $key2 => $value2) { //LEVEL 2 - This foreach statement traverses the set of indexed arrays whose elements are a key-value pair of indices and arrays. Each array is a value of the actionDetails element of a visit. if (is_array($value2)) { $matomo_action = new TranslateMatomoAction($key3,$value3); foreach($value2 as $key3 => $value3) { //LEVEL 3 - This foreach statement traverses the elements of the associative array corresponding to the value of $key2. $matomo_action($key3, $value); } } } } DILEMMA: Unfortunately, the above procedure fails to fill the values of the object's property as expected. QUESTION: Where have I gone wrong? Roddy
  4. I have a challenge to solve regarding PDO and executing prepared statements inside a class. The way I made the script now is giving an error as output, though the outcome required is okay. The error type is: Fatal error: Uncaught ArgumentCountError: Too few arguments to function fruit_stock::get_fruit(), 0 passed in Could it be the error is caused because PHP requires that the execute() part should be defined or something like that? I really dont get what to do with it or with $stmt . . This are the scripts and the table so you can test it yourself. I'm curious how this is done. database table : -- phpMyAdmin SQL Dump -- version 4.7.4 -- https://www.phpmyadmin.net/ -- -- Host: localhost:3306 -- Generation Time: Oct 04, 2018 at 08:42 AM -- Server version: 5.7.19 -- PHP Version: 7.1.9 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `test_fruit` -- -- -------------------------------------------------------- -- -- Table structure for table `fruit` -- DROP TABLE IF EXISTS `fruit`; CREATE TABLE IF NOT EXISTS `fruit` ( `rec_nr` int(2) NOT NULL AUTO_INCREMENT, `fruit_type` varchar(50) DEFAULT NULL, `amount` int(3) NOT NULL, `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `changed_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`rec_nr`,`created_on`,`changed_on`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; -- -- Dumping data for table `fruit` -- INSERT INTO `fruit` (`rec_nr`, `fruit_type`, `amount`, `created_on`, `changed_on`) VALUES (1, 'apple', 5, '2018-10-04 06:01:48', '2018-10-04 06:01:48'), (2, 'strawberry', 20, '2018-10-04 06:01:48', '2018-10-04 06:01:48'), (2, 'banana', 15, '2018-10-04 06:02:54', '2018-10-04 06:02:54'), (4, 'grapes', 9, '2018-10-04 06:02:54', '2018-10-04 06:02:54'); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; Script 1: <?php // run class $amount = '20' ; include 'fruit-class1.php'; $tel_wrg = new fruit_stock('$amount'); $tel_wrg -> get_fruit($amount); var_dump($tel_wrg); echo $tel_wrg -> get_fruit(); ?> Script 2 : <?php // test classes class fruit_stock { var $amount; public $get_fruit; public function get_fruit($amount ) { var_dump($amount); var_dump($this); $servername = "your host"; $username = "your name"; $password = "your password"; $dbname = "test_fruit"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // PREPARED if ($stmt = $conn->prepare("SELECT fruit_type FROM fruit WHERE amount = ? ; " )) { $stmt->bind_param('i', $amount); // $stmt->execute(); $stmt->bind_result($fruit_type); while ($stmt->fetch()) { var_dump($fruit_type); } } } }
  5. BACKGROUND: I am creating a custom class for use with PHPMailer that will hopefully eliminate redundancy in its application and even facilitate my use of the class. One of my questions deals with inheritance and the other has to do with scope. My current use of PHPMailer is quite simple. It consists of a folder containing four files: three of these are PHP class definitions and one of them is an autoloader. PHPMailer is called in the following manner: require_once '../../../PHPMailerAutoload.php'; $mail = new PHPMailer; Once the instance $mail has been created I have access to a large number of public functions that I have thought to consolidate into a single class of my own making called PHPGlobalMailer. My construction of this class appears awkward, and I would like to solicit your feedback in an attempt to remove its clumsiness. class PHPGlobalMailer { private $mail; private static $char_set = 'UTF-8'; private static $smtp_debug = 0; // SMTP::DEBUG_OFF (0): Disable debugging (default). // SMTP::DEBUG_CLIENT (1): Output messages sent by the client. // SMTP::DEBUG_SERVER (2): as 1, plus responses received from the server. // SMTP::DEBUG_CONNECTION (3): as 2, plus more information about the initial connection (used to diagnose STARTTLS failures. // SMTP::DEBUG_LOWLEVEL (4): as 3 (Verbose). private static $debug_output = 'html'; // 'echo': Plain text output (default). // 'html': Browser output. // 'error_log': Output to php.ini configured error.log. // function($str, $level) {echo "Debug Level: " . $level; "Error Message: " . $str;} private static $hostserver = '...'; private static $server_port = ...; private static $smpt_auth = 'true'; private static $mail_account_name = '...'; private static $mail_account_password = '...'; private static $from_mail_address = '...'; private static $from_mail_name = '...'; private static $reply_to_address = '...'; private static $reply_to_name = '...'; public $email = ''; public $name = ''; public $subject = ''; public $html_message = ''; public $alt_message = ''; public function __construct($email, $name, $subject, $html_message, $alt_message) { if ($this->mail new PHPMailer) { $this->mail->CharSet=self::$char_set; $this->mail->isSMPT(); $this->mail->SMTPDebug = self::$smpt_debug; $this->mail->Debugoutput = self::$debug_output; $this->mail->Host = self::$hostserver; $this->mail->Port = self::$server_port; $this->mail->SMPTAuth = self::$smpt_auth; $this->mail->Username = self::$mail_account_name; $this->mail->Password = self::$mail_account_password; $this->mail->setFrom(self::$from_mail_address, self::$from_mail_name); $this->mail->addReplyTo(self::$reply_to_address, self::$reply_to_name); $this->mail->addAddress($this->email, $this->name); $this->mail->Subject = $this->subject; $this->mail->msgHTML($html_message); $this->mail->altBody = $alt_message; } else { echo "Error: Failure to create new PHPMailer instance."; } } public function get_character_set() { return self::$char_set; } public function set_character_set($char_set) { self::$char_set = $char_set; } public function get_smtp_debug() { return self::$smtp_debug; } public function set_password($smtp_debug) { self::$smtp_debug = $smtp_debug; } public function get_debug_format() { return self::$debug_output; } public function set_debug_format($debug_output) { self::$debug_output = $debug_output; } public function get_debug_format() { return self::$debug_output; } public function set_debug_format($debug_output) { self::$debug_output = $debug_output; } public function get_mail_instance() { return $this->mail; } } The AWKWARDNESS 1) In order to make it work I must include PHPMailerAutoload.php file. Is there someway that I could avoid this, say through inheritance? 2) Notice that I am creating an instance of PHPMailer inside my class and then using the instance's public functions to modify it. Is this proper? If not, what would be a more appropriate way of constructing my class. 3) I am concerned that adjustments to an instance of PHPGlobalMailer will affect other instances created in a similar manner. For example, were I to change the value of $smpt_debug for a particular instance of PHPGlobalMailer would it not effect the value of that same parameter for other instances of PHPGlobalMailer? In effect, I would like full control of each instance, but still maintain constancy with regard to the $account_name and $account_password and other values across all instances. Could you please comment on each of three points. Roddy
  6. BACKGROUND: I am in the process of writing a class that will match and update rows in a MySQL data base. The field that contains the values against which a match is to be discovered must be indefinite. The values that it can contain are either 0 or 1 as defined by an ENUM field type. I know both the desired field and value before the matching routine commences. I want the UPDATE routine to set the value of the field to its opposite: 0 => 1 or 1 => 0. CURRENT STATE OF THE CODE: <?php class VeriFirm { private $mysqli_obj; private $username; private $email; private $hash; private $action = 0; private $field; private $tbl_name = 'captive_roster'; public $link = 'admin@grammarcaptive.com'; public $subject = 'Grammar%20Captive%20-%20Verify%20and%20Confirm%20User%20Action'; public $msg_mismatch = "Sorry, " . $this->username . ", but no matching entry in the Grammar Captive database was found. Please try again! If the problem persists, contact the Grammar Captive <a class='link_style' href='" . create_link() . "' title='Grammar Captive Online Administrator' target='_top'>webmaster</a> and expect a reply in response to your additional effort!"; public $msg_success = "Congratulations, " . $this->username . ", your desired action was successfully processed. No further action is required on your part."; public $msg_failure = "Sorry, " . $this->username . ", but Grammar Captive was unable to process your desired action. It appears that your account status has already been reset. If the problem persists, please contact the Grammar Captive <a class='link_style' href='" . create_link() . "' title='Grammar Captive Online Administrator' target='_top'>webmaster</a> and expect a reply in response to your additional effort!"; function __construct($mysqli_obj, $_GET, $field) { $this->mysqli_obj = $mysqli_obj; $this->field = $field; if((isset($_GET['username']) && !empty($_GET['username'])) AND (isset($_GET['email']) && !empty($_GET['email'])) AND (isset($_GET['hash']) && !empty($_GET['hash']))){ $this->$username = $mysqli_obj->real_escape_string($_GET['name']);; $this->$email = $mysqli_obj->real_escape_string($_GET['email']); $this->$hash = $mysqli_obj->real_escape_string($_GET['hash']); $this->$action = $mysqli_obj->real_escape_string($_GET['action']); } } function create_link() { return $mailto = "mailto:" . $this->link . "?Subject=" . $this->subject; } function match_data() { $sql_select = "SELECT user_name, email_address, hash, " . $this->field . " FROM " . $this->tbl_name . " WHERE user_name=? AND email_address=? AND hash=? AND " . $this->field . "=" . $this->action; $mysqli_stmt = $this->mysqli_obj->stmt_init(); $mysqli_stmt->prepare($sql_select); $mysqli_stmt->bind_param("ssss", $this->username, $this->email, $this->hash, $this->field); $mysqli_stmt->execute(); $mysqli_result = $mysqli_stmt->get_result(); $match = mysqli_num_rows($mysqli_result); if($match > 0){ update_record(); } else { return $msg_mismatch; } } function update_record() { if ($this->action == 0) { $sql_update = "UPDATE " . $this->tbl_name . " SET " . $this->field . "='1' WHERE user_name=? AND email_address=? AND hash=? AND ". $this->field . "=0"; $mysqli_stmt->prepare($sql_update); $mysqli_stmt->bind_param("sss", $this->username, $this->email, $this->hash); if ($mysqli_stmt->execute()) { return $msg_success; } else { return $msg_failure; } } else if ($this->action == 1) { $sql_update = "UPDATE " . $this->tbl_name . " SET " . $this->field . "='0' WHERE user_name=? AND email_address=? AND hash=? AND ". $this->field . "=1"; $mysqli_stmt->prepare($sql_update); $mysqli_stmt->bind_param("sss", $this->username, $this->email, $this->hash); if ($mysqli_stmt->execute()) { return $msg_success; } else { return $msg_failure; } } function get_link_and_subject() { return $this->link . ' and ' . $this->subject; } function set_link_and_subject($link, $subject) { $this->link = $link; $this->subject = $subject; } function get_tablename() { return $this->tbl_name; } function set_tablename($tbl_name) { $this->tbl_name = $tbl_name; } function get_msg_mismatch() { return $this->msg_mismatch; } function set_msg_mismatch($msg_mismatch) { $this->msg_mismatch = $msg_mismatch; } function get_msg_success() { return $this->msg_success; } function set_msg_success($msg_success) { $this->msg_success = $msg_success; } function get_msg_failure() { return $this->msg_failure; } function set_msg_failure($msg_failure) { $this->msg_failure = $msg_failure; } } ?> I am primarily concerned about the following: if((isset($_GET['username']) && !empty($_GET['username'])) AND (isset($_GET['email']) && !empty($_GET['email'])) AND (isset($_GET['hash']) && !empty($_GET['hash']))){...} Is this a proper use of the $_GET superglobal or would a $_POST or $_REQUEST superglobal be more appropriate. I am concerned about making user's private information public. This said, all communication with the Grammar Captive website is now available to TLS/SSL protocol -- namely, the https:// prefix. $sql_select = "SELECT user_name, email_address, hash, " . $this->field . " FROM " . $this->tbl_name . " WHERE user_name=? AND email_address=? AND hash=? AND " . $this->field . "=" . $this->action; Is this statement properly specified? I am concerned about the placement of the quotation marks and the ability of the mysqli_stmt object to read properly the intended SQL statement. $mysqli_stmt = $this->mysqli_obj->stmt_init(); Is this proper use of the -> operator in the construction of a PHP Class. $sql_update = "UPDATE " . $this->tbl_name . " SET " . $this->field . "='1' WHERE user_name=? AND email_address=? AND hash=? AND ". $this->field . "=0"; Is this statement properly described? Once again, my focus is on the use of quotations marks to define the statement. update_record() Is this the most efficient way to achieve the desire goal -- namely, to toggle the value of action between 0 and 1 depending on an initially assumed value of $this->field. Roddy
  7. I'm quite new to coding, and have big trouble understanding the logic in even the supposedly easiest languages to learn. However, what is the functional differences between .class and #id? Is there situations where only either of them can be used? I can't see any difference by reading the W3 pages about them (respectively https://www.w3schools.com/cssref/sel_class.asp and https://www.w3schools.com/cssref/sel_id.asp).
  8. https://www.w3schools.com/w3css/w3css_sidebar.asp Hello. I'm researching the above page as a starting point, and ive also googled and found there is no "CLASS" version of the getElementById command. basically, I want to do a full table, but a number of rows (by criteria) will be given a class name. what i am after is a way to "hide" or remove those selected rows from the table. but if i press a button, the rows will re-emerge & show themselves into the table - NOT as a separate / distinct table, but seamless into the same table. has anyone got a W3CSS (javascript) command/process to do this by class instead of ID ?
  9. <?php /* * DB Class * This class is used for database related (connect, insert, update, and delete) operations * @author CodexWorld.com * @url http://www.codexworld.com * @license http://www.codexworld.com/license */ class DB{ private $dbHost = "..."; private $dbUsername = "..."; private $dbPassword = "..."; private $dbName = "..."; public function __construct(){ if(!$this->db){ // Connect to the database $conn = new mysqli($this->dbHost, $this->dbUsername, $this->dbPassword, $this->dbName); if($conn->connect_error){ die("Failed to connect with MySQL: " . $conn->connect_error); }else{ $this->db = $conn; } } } /* * Returns rows from the database based on the conditions * @param string name of the table * @param array select, where, order_by, limit and return_type conditions */ public function getRows($table,$conditions = array()){ $sql = 'SELECT '; $sql .= array_key_exists("select",$conditions)?$conditions['select']:'*'; $sql .= ' FROM '.$table; if(array_key_exists("where",$conditions)){ $sql .= ' WHERE '; $i = 0; foreach($conditions['where'] as $key => $value){ $pre = ($i > 0)?' AND ':''; $sql .= $pre.$key." = '".$value."'"; $i++; } } if(array_key_exists("order_by",$conditions)){ $sql .= ' ORDER BY '.$conditions['order_by']; } if(array_key_exists("start",$conditions) && array_key_exists("limit",$conditions)){ $sql .= ' LIMIT '.$conditions['start'].','.$conditions['limit']; }elseif(!array_key_exists("start",$conditions) && array_key_exists("limit",$conditions)){ $sql .= ' LIMIT '.$conditions['limit']; } $result = $this->db->query($sql); if(array_key_exists("return_type",$conditions) && $conditions['return_type'] != 'all'){ switch($conditions['return_type']){ case 'count': $data = $result->num_rows; break; case 'single': $data = $result->fetch_assoc(); break; default: $data = ''; } }else{ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $data[] = $row; } } } return !empty($data)?$data:false; } } $test = new DB(); if ($test instanceof DB) { echo 'Instantiated'; } else { echo 'Uninstantiated. Include failed.'; } $conditions = []; $tbl_name = 'rss2_podcast_item'; $test->getRows($tbl_name, $conditions); function getRows($mysqli_obj, $table,$conditions = array()){ $sql = 'SELECT '; $sql .= array_key_exists("select",$conditions)?$conditions['select']:'*'; $sql .= ' FROM '.$table; if(array_key_exists("where",$conditions)){ $sql .= ' WHERE '; $i = 0; foreach($conditions['where'] as $key => $value){ $pre = ($i > 0)?' AND ':''; $sql .= $pre.$key." = '".$value."'"; $i++; } } if(array_key_exists("order_by",$conditions)){ $sql .= ' ORDER BY '.$conditions['order_by']; } if(array_key_exists("start",$conditions) && array_key_exists("limit",$conditions)){ $sql .= ' LIMIT '.$conditions['start'].','.$conditions['limit']; }elseif(!array_key_exists("start",$conditions) && array_key_exists("limit",$conditions)){ $sql .= ' LIMIT '.$conditions['limit']; } $result = $mysqli_obj->query($sql); if(array_key_exists("return_type",$conditions) && $conditions['return_type'] != 'all'){ switch($conditions['return_type']){ case 'count': $data = $result->num_rows; break; case 'single': $data = $result->fetch_assoc(); break; default: $data = ''; } }else{ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $data[] = $row; } } } return !empty($data)?$data:false; } ?> <?php $tbl_name = 'rss2_podcast_item'; $conditions = []; print_r(getRows($mysqli_obj,$tbl_name,$conditions)); ?> Please find above two sets of code and a quoted error message from the first set. The first set of code is a portion of a PHP class called DB. The second set of code is extracted from the first and modified in order to test the integrity of the function. At the bottom of each block of code is included the code necessary to call the getRows() method/function. Whereas the method of the class fails, the extracted function does not. In both cases the same database and table are accessed with success. I am suspicious of the way in which the class is constructed. I have tried several modifications, but none of them appear to work. Roddy
  10. Hello! Is there any way I can add a specific class to svg tag? I try to do that: .svgclass{ stroke: lightblue; stroke-width: 2px; display:inline-block; position:absolute; z-index:1; right: 0px; top: 10px; margin:0px 0px 0px 0px; padding:0px 0px 0px 0px; height:80px; width:1px; } And in the body: <svg class="svgclass"><line x1="0" y1="0" x2="0" y2="80" /></svg> This is not work... (And the svg style is set good, cause when I remove the class from the svg, and change in the css file to svg its all great..) Thanks! (:
  11. Can anyone sight an example to demonstrate the use of Responsive Class and Responsive Grids of W3 CSS? It would be great to understand, if the piece of code shows how to use them together.
  12. Please consider the following code and answer the question. Please do not omit your reasons for answering as you did. CODE SYNOPSIS: This handy piece of code places a constraint on the number of words that can be placed in a selected <textarea> element. In addition, it displays the current status of the selected element as one enters text. This code, less the iterative aspect, has been tested for one <textarea> element, but I wish now to expand it to include many <textarea> elements. In order to do this I created a mixed associative array (see below) whose data I use to select each <textarea> element and apply a different constraint. Although I have identified each <textarea> element by its unique id='' attribute I have used the class='' attribute to display the current status of the selected <textarea> element. My motivation for doing this latter is, of course, one of efficiency. My belief is that specific overrides general, and that the values generated by the id='' attribute will override those designated by the class='' attribute -- a designation that is common to all <textarea> elements. QUESTION: Is this sound Javascript programming logic? Or, must I change the class='' attributes to the same id='' attribute for each <textarea> element? <?php foreach($wordmax as $textarea => $arr) { $area_id = $arr['id']; $max = $arr['length']; $($area_id).on('keydown', function(e) { var words = $.trim(this.value).length ? this.value.match(/\S+/g).length : 0; if (words <= $max) { $('.display_count').text(words); $('.words_remaining').text($max-words); }else{ if (e.which !== 8) e.preventDefault(); } }); } ?> <textarea id='letter_body' name='letter_body'>...</textarea><br /> Word Count: <span class='display_count'>0</span> Words Remaining: <span class='words_remaining'>0</span> <textarea id='letter_abstract' name='letter_abstract'>...</textarea><br /> Word Count: <span class='display_count'>0</span> Words Remaining: <span class='words_remaining'>0</span> $wordmax = array( 'letter_abstract' => array ( 'id' => '#letter_abstract', 'length' => '150' ), 'letter_body' => array ( 'id' => '#letter_body', 'length' => '800' ), . . . 'student_bio' => array ( 'id' => '#student_bio', 'length' => '400' ), );
  13. My code doesnt work the way I want it. The goal is a gradient background. I made an external style sheet. Like this: .grad{ height: 1020px; width: 1900px; /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#feffff+0,ddf1f9+35,a0d8ef+100;Blue+3D+%2318 */ background: #feffff; /* Old browsers */ background: -moz-linear-gradient(top, #feffff 0%, #ddf1f9 35%, #a0d8ef 100%); /* FF3.6-15 */ background: -webkit-linear-gradient(top, #feffff 0%,#ddf1f9 35%,#a0d8ef 100%); /* Chrome10-25,Safari5.1-6 */ background: linear-gradient(to bottom, #feffff 0%,#ddf1f9 35%,#a0d8ef 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#feffff', endColorstr='#a0d8ef',GradientType=0 ); /* IE6-9 */ } .maincell { text-align: left; width: 1900px; } .topcell { horizontal-align: left; height: 100px; } .downcell { horizontal-align: left; height: 600px; } The html code <html> <head> <link rel="stylesheet" type="text/css" href="style3.css"> </head> <body class="grad"> <FRAMESET ROWS="15%,85%" frameBorder="0" border="0"> <FRAME SRC="carn_head.php" name="navigatie" scrolling="no"> <FRAME SRC="carn_bottom.html" bordercolor="#CBEDF1" name="main"> </FRAMESET> </body> </html> The error is that I get to see a gradient background but not the code put in the pages. It used to when I hadnt add the .grad class. How can I have a gradient background and over it a frame showing the pages intended in the frame src?
  14. I love what w3schools is doing with the SQL tutorial - good stuff. I noticed that one of the most fundamental elements of w3schools (the "Try it now" button) goes missing about half-way through the SQL Tutorial. May I ask why? I teach sql at a local community colleg. I have gone through several textbooks with mixed results, and I am always keeping my eyes open for new ways to teach. I would love to incorporate w3schools SQL tutorial into my class; do you have a db dump available for download of the tables you use? One of my lessons will be having students figuring out how to get the data from the tutorial into a local database, but having the entire dataset available up front would be handy. If such a db dump is not available, no worries - easy enough to generate one. Thanks again for your time and attention.
  15. I was wondering if javascript or jquery could change the look of a CSS class in a function called by a onclick(). For example I have a #first and also a .unclicked and .clicked. And i have a input type="button" id="first" class="unclicked" onclick="function()". function(){ change class from unclicked to clicked on first then some other code } Inside the function how do i change the class from unclicked to clicked. I know you haft to use the document.getid(first).style, but I'm not sure how to get the function to change it.
  16. hello, i am learning PHP, but when i read the next section PHP exception, i do not understand about "class", "public" and why it is used "extends", i hope you can help me solve the problem!!!, Thank you. So i am trying to learn English, if i have misspelled i hope you forgive!!!
  17. Hello, I have a master div ID element which contains smaller class elements (boxes) which are currently set to float left. I would like these class elements to be centred within my master div and remain centred when the windowm scales. There also needs to be a space between the class elements (boxes) and there are two class elements positioned next to each other. My master div ID element which encapsulates the smaller classes has the following CSS #master { border: none; width: 100%; height:auto; margin-top: 0; margin-right: auto; margin-bottom: 0; margin-left: auto; overflow: hidden; } I tried to text-align: centre but it didn't centre the class elements, rather just the text within the boxes (class divs). The class elements which I want to centre have the following CSS: .profilebox{ border: 1px solid #FFCC99; height: auto; width: 390px; float: left; margin-top: 14px; margin-right: 0px; margin-bottom: 10px; margin-left: 20px; border-radius: 5px; overflow: hidden;/*this togther with the height auto ensures this parent div encapsulates all child divs*/ } I tried to remove float: left and set margin right and left to auto but then then instead of having two of these boxes side by side, I had just one (and the other moved underneath). Many thanks for reading this post:)
  18. In trying to make a "talkbubble" styled div- box change colors completely upon being clicked, I ran into a problem of getting the :before pseudo element that I'm using (to shape the arrow for the talkbubble) to actually change colors with the rest of the element. My script is http://jsfiddle.net/petiteco24601/3xuuq2fx/. When I couldn't get it to work, I did some research and it seems what/how to control pseudo-elements is a question that most web developers seem shaky about. For the most part, a lot of what I found was basically saying that there's no way to really force javascript on a pseudo element, since the pseudo element doesn't REALLY exist. However, with more research, I found things like http://css-tricks.com/pseudo-element-animationstransitions-bug-fixed-in-webkit/ andhttp://stackoverflow.com/questions/2610497/change-an-inputs-html5-placeholder-color-with-css/2610741#2610741 that say that those bugs were fixed and it is possible with some browsers to use javascript on pseudo elements. What's the actual deal? How extensively can a person control pseudo elements?
  19. I have created a calendar for my golf league and wish to color code the days that we play with a specific color and other events different colors. We play on a thursday so I would like to color code all thurdays "green" My question is, what would be the best and most professional way to do this? Would creating an external css file and giving each Thursday the same ID or class name? Would a Class designation be better? Would the following coding example be appropriate? Any help would be greatly appreciated Thank you CSS file: .thursday { bgcolor: green; } HTML file: <td class = "thursday">.......
  20. Hello once again, i will do this one short, since i feel stupid asking about it, but its a must since i cannot remember, and might be a rookie question -.-'... anyhow, here is my css: .chat_div_bottom_global_friend_list_button a:hover { text-decoration:none; color:#CDCDCD; background-color:#900; } .chat_div_bottom_global_friend_list_button a:link,a:visited,a:active { text-decoration:none; color:#CDCDCD; } here is my html: <span class='chat_div_bottom_global_chat_rooms_button'> Chat Room (Public)</span> <span class='chat_div_bottom_global_friend_list_button'> <a href='#'>Friend list (0)</a></span> now the question, i have a background to the link, but i would like that background, to cover the whole span if possible, any ideas? X)... [PICTURE ATTACHED]
  21. Hello Internet. Back for another question. I am using CSS styling to make an image larger during a hover event. I have made the code work for IE but Safari does not like it. Actually what Safari is doing is once you click on the image it will show the original image AND the hover image together and separated. The desired effect is that once you hover over an image it will increase the image size. Please help... Here is my CSS code:.thumbnail{position: relative;}/*CSS for enlarged image*/.thumbnail span{position: relative;padding: 0px; left:0px; border: 0px solid #000000;visibility: hidden; color: black; text-decoration: none;}/*CSS for enlarged image*/.thumbnail span img{border-width: 1px solid #000000;padding: 0px;}/*CSS for enlarged image on hover*//*position where enlarged image should offset horizontally */.thumbnail:hover span{visibility: visible;top: -64px;left: -5px;} /*CSS to place DIV around the original image so it does not disturb the rest of my page*/.enlrg{ width:60px; height:70px; border: 1px solid #ffffff; float: left; margin-left: 0px;} Here is my HTML Code:<div id="enlarge" class="enlrg"><a class="thumbnail" href="http://espn.go.com/mens-college-basketball/team/_/id/97/louisville-cardinals" target="_blank"><img src="lvillelogo1.jpg" width="50" height="38" style="float: left; margin-left: 13px; margin-top: 20px;"><span><img src="lvillelogo1.jpg" width="60" height="44" style="float: left; margin-left: 13px; margin-top: 20px;"></span></a></div><div id="enlarge" class="enlrg"><a class="thumbnail" href="http://espn.go.com/mens-college-basketball/team/_/id/2483/oregon-ducks" target="_blank"><img src="oregonlogo1.jpg" width="50" height="38" style="float: left; margin-left: 9px; margin-top: 20px;"/><span><img src="oregonlogo1.jpg" width="60" height="44" style="float: left; margin-left: 9px; margin-top: 20px;"></span></a></div>
  22. This question is specific to named CSS selectors. There is probably an obvious answer to this question, so I apologize ahead of time. If I wanted to apply a property to a bunch elements I would use a class; could I also use an id to give individual properties to any of those elements? Basically, can a single element have a class and an id? Can there be multiple classes? If so, is this proper html to do it this way, for all the main doctypes?I'm just confused, because I don't think I've ever seen any examples whilst learning, in which an element has a class and an id. Are there any other methods for selecting name elements with CSS (that are compatible with all main browsers), other than "class", "id", and "title"? Any help would be appreciated.
  23. Hellooo.. :DCould you please tell me the difference between id and class?I think that it is the same..Take a look ! Using ID : <!DOCTYPE html><html><head><style>#center{text-align:center;}</style></head> <body><h1 id="center">Center-aligned heading</h1><p id="center">Center-aligned paragraph.</p> </body></html> Using Class : <!DOCTYPE html><html><head><style>.center{text-align:center;}</style></head> <body><h1 class="center">Center-aligned heading</h1><p class="center">Center-aligned paragraph.</p> </body></html> I see there's no difference, but in w3schools.com,It says that The id SelectorThe id selector is used to specify a style for a single, unique element.The id selector uses the id attribute of the HTML element, and is defined with a "#". The class SelectorThe class selector is used to specify a style for a group of elements. Unlike the id selector, the class selector is most often used on several elements.This allows you to set a particular style for many HTML elements with the same class.The class selector uses the HTML class attribute, and is defined with a "." But, i think the id selector can also be for a group of elements.. Please explain this !
  24. terryds

    About classes

    Hey, everyone.. :DI want to ask something about classes..Can you tell me the difference between p class, span class, and other classes?Thx before
  25. I have 2 questions. First one is most important! I attach the php, and the css files here for you (Hello dsonesuk ) to look and maybe help me with this. I may know how to do this, but then i might need to change it all and do it all from a a beginning again. So i would like a fast change advise for this problem. Anyway here it goes: I have the class called "sidboxes" wich are located to the right of the container(browser). And in that class 3 classes - the classes are called sidbox1, 2, and 3 for each of the 3 boxes. So i have now as you can see in the css an position:absolute. When i minimize the window here at the workplace i am, it moves around 5-10 mm. But when i am at home at the laptop this whole class move about 10 cm into the middle! I tried(not at home though but here where i am now on a different computer.) to write relative instead(as i think it actually must be relative!) but then this whole class moves down and makes a big space below everything. Now the images are not attached but i think you know how to help anyway . The boxes are supposed to be at the same place AS they are when having the absolute tag, BUT not move around when minimizing a window. As neither absolute seems to be the right tag to use, i need help now, cause i tried with relative both outside and inside the container i have. 2 question: What can i do to remove that empty space at the bottom wich is about 2-3 cm???? (the last cssfile attached is for the menyboxes to the left. I think the empty space got to do with them....) index52.php pse52.css pse5menyset2.css
×
×
  • Create New...