-
CSS3 Selectors ?!?!
Hi, Im having real trouble using css selectors, its making no sense. All I want to do is select the first image in a div and give it a border and padding, however everything I try ends up applying to all images. The html is like so <div class="project-item"> <div class="project-left"> <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail(); } ?> <a href="<?php the_permalink();?>" title="Click for More" class="description"> <img src="<?php bloginfo('template_directory'); ?>/images/magnify_solid.png" /> Want to read more? </a> </div> <div class="project-right"> <h3><?php the_title(); ?></h3> <?php the_excerpt(); ?> <a class="readmore" href="<?php the_permalink();?>">Read More</a> </div> </div> I have tried everything from .project .project-left img:frist-child to .project .project-left img:first-of-type Can anyone help me target the first image in .project-left?? Thanks
- Websites for images?
-
look for a JavaScript Guru's opinion/help
There is usually a number of different ways of doing anything in javascript and jQuery, and the best method to use really depends on the circumstances, but what you have used above is fine, it gets the job done nicely.
-
www
How come some websites by-pass the use of www. for example http://api.jquery.com/ How has it managed to change www for api. :S also how can I do this if I had a website called www.example.co.uk on a host like godaddy or media temple? Thanks
-
Google Maps API
Hi, I am attempting use Google Maps API to create two auto complete input boxes along with a map to mark the positions. Currently based on the examples in the Docs I have got a single input box which works with auto-complete and places a marker on the map, however I would now like to expand on this and have a second input box with does the same thing on the <strong>same map</strong>, but having trouble achieving it. The code so far is <script type="text/javascript"> function initialize() { var mapOptions = { center: new google.maps.LatLng(-33.8688, 151.2195), zoom: 13, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById('map'), mapOptions); var input = document.getElementById('frombox'); var autocomplete = new google.maps.places.Autocomplete(input); autocomplete.bindTo('bounds', map); var infowindow = new google.maps.InfoWindow(); var marker = new google.maps.Marker({ map: map }); google.maps.event.addListener(autocomplete, 'place_changed', function() { infowindow.close(); var place = autocomplete.getPlace(); if (place.geometry.viewport) { map.fitBounds(place.geometry.viewport); } else { map.setCenter(place.geometry.location); map.setZoom(15); } var image = new google.maps.MarkerImage( place.icon, new google.maps.Size(71, 71), new google.maps.Point(0, 0), new google.maps.Point(17, 34), new google.maps.Size(35, 35)); marker.setIcon(image); marker.setPosition(place.geometry.location); var address = ''; if (place.address_components) { address = [(place.address_components[0] && place.address_components[0].short_name || ''), (place.address_components[1] && place.address_components[1].short_name || ''), (place.address_components[2] && place.address_components[2].short_name || '') ].join(' '); } infowindow.setContent('<div><strong>' + place.name + '</strong><br>' + address); infowindow.open(map, marker); }); // Sets a listener on a radio button to change the filter type on Places // Autocomplete. function setupClickListener(id, types) { var radioButton = document.getElementById(id); google.maps.event.addDomListener(radioButton, 'click', function() { autocomplete.setTypes(types); }); } setupClickListener('changetype-all', []); setupClickListener('changetype-establishment', ['establishment']); setupClickListener('changetype-geocode', ['geocode']); } google.maps.event.addDomListener(window, 'load', initialize); </script> Could anyone help me set up the second input box called #tobox to do the same thing on the same map, I would really appreciate it. Thanks
-
Codeigniter
Hi, I am trying to run an SQL query in codeigniter which looks as follows function getActiveBookings() { $this->buildMaps(); $query = $this->db->get_where('Bookings', array('Status' => 0, 'Driver_ID' => null)); if($query->num_rows() > 0) { $data = array(); foreach($query->result() as $row){ $row->customer = $this->get_customer($row->Customer_ID); $data[] = $row; } return $data; } else{ return false; } } This grabs all bookings and if a customer ID is assigned grab the customer information too. However I am having trouble getting the customer information out in the view, I am trying to following <?php echo $row->customer->Name; ?> How this gives me the error A PHP Error was encountered Severity: Notice Message: Trying to get property of non-object Filename: admin/dashboard.php Line Number: 30 Can anyone help? Cheers
-
SQL Join
Hi, I have two tables, one being Bookings and the other being Customers. A booking is linked to the customer table with a Customer_ID field which is NULL by Default, and updated when a customer is assigned. I am trying to run an SQL Query in codeigniter which pulls back all the bookings, and is joined with the customer table by Customer_ID, however the statement does not seem to work as nothing is pulled back when the join is added. Here the statement $this->db->select('*'); $this->db->from('Bookings'); $this->db->join('Customers', 'Customers.ID = Bookings.Customer_ID'); $query = $this->db->get(); return $query->result(); I guess the problem must be related to the fact that many bookings don't have a customer ID to join, but I guessed it would only do it to bookings that did. Does anyone know the correct way to this?
-
- Jquery Ajax URL
-
Jquery Ajax URL
Hi, Im building an application using codeigniter which uses some ajax. Here is the ajax call I am making $.ajax({ type: 'get', url: '<?php echo base_url(); ?>index.php/booking/addDriver', data: '/1/2/', beforeSend: function() { }, success: function() { dragged.parentNode.removeChild(dragged); } }); From this I want to generate the URL http://localhost/TaxiBooking/index.php/booking/addDriver/1/2/ However it keeps generating http://localhost/TaxiBooking/index.php/booking/addDriver?/1/2/ The URL part of the AJAX keeps adding the ? mark at the end which is not required for codeigniter and brakes the call Anyone know how I can stop the URL doing this Thanks
-
PHP & SQL NULL
This doest seem to work either, they only way I have managed to get it to work so far is to place 'NULL' in where the %s are, however this removes the ability to add a value if there is one
-
PHP & SQL NULL
Hi, Thanks for the help I am doing my statement like so unction archive() { $query = sprintf("INSERT INTO Archive (ID, From_Address, From_Lat, From_Lng, To_Address, To_Lat, To_Lng, Driver_ID, Customer_ID, Date, Status, Reason, Created, Special_Request, Complete) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s');", mysql_real_escape_string($this->id), mysql_real_escape_string($this->fromAddress), mysql_real_escape_string($this->fromLat), mysql_real_escape_string($this->fromLng), mysql_real_escape_string($this->toAddress), mysql_real_escape_string($this->toLat), mysql_real_escape_string($this->toLng), mysql_real_escape_string($this->driverID), mysql_real_escape_string($this->customerID), mysql_real_escape_string($this->date), mysql_real_escape_string($this->status), mysql_real_escape_string($this->reason), mysql_real_escape_string($this->created), mysql_real_escape_string($this->specialRequest), mysql_real_escape_string($this->complete)); $result = mysql_query($query); Im guessing mysql_real_escape_string is in someway preventing NULL from going in without being a string.
-
PHP & SQL NULL
Hi, Im getting problems when trying to set columns (particularly foreign key ones) as null instead of blank in my database. I have two tables being Booking and Archive. When a booking is complete or deleted it is placed in the archive table. The problem is there are a few fields which may be empty including two foreign key fields. If there value is empty I need null to be placed in there field. Currently the system attempts to add blank space into the fields which causes a foreign key contraint error show below. Runing Booking Function test 123 fake streed Invalid query: Cannot add or update a child row: a foreign key constraint fails (`taxi booking system`.`archive`, CONSTRAINT `archive_ibfk_9` FOREIGN KEY (`Driver_ID`) REFERENCES `drivers` (`ID`)) Whole query: INSERT INTO Archive (ID, From_Address, From_Lat, From_Lng, To_Address, To_Lat, To_Lng, Driver_ID, Customer_ID, Date, Status, Reason, Created, Special_Request, Complete) VALUES ('8', '123 Fakestreet', '50.822563', '-1.071819', '', '', '', '', '', '0000-00-00 00:00:00', '1', '', '2012-01-11 14:50:03', '', '1'); DriverID and CustomerID are both forigen keys in the table however in this case they are blank and causing the error. I have tried checking each variable and if its empty placing "NULL" into it, however the database seems to still accept that as a string and gives the same error Can anyone tell me how to correctly add NULL to any fields which are empty? Thanks in advance Ben Gibson
-
Web App Secuirity
Hi, I have been playing around with ruby on rails and was wondering how you secure pages that use a simple GET request. For example a logged in Admin can view details of any staff member. When the admin clicks a certain staff member there ID is passed in the URL to a page that shows the selected staff member. This is done in a link like so localhost:3000/workers/show/7 However anybody can simple change the starting URL localhost:3000/ to localhost:3000/workers/show/7 and view the worker without even logging in. Is there a simple way to stop access to any page other than the login page, until the the user has logged in and the session is not nil
-
Ruby on Rails Post Method
Hi, Ruby on rails is driving me crazy, how do you simply link to a view using the post method rather than get. Nothing is ever simple in rails at all!!!! I have these two in my route file map.new 'project/new', :controller => 'projects', :action => 'new', :conditions => {:method => :post} map.edit 'worker/edit', :controller => 'workers', :action => 'edit', :conditions => {:method => :post} With the following links on my index page <%= link_to "Edit", edit_url, :id => worker.id, :method => :post %> <%= link_to "New Project", new_url, :id => @project.id, :method => :post, :class => 'link-button' %> That approach stops any id being passed at all and results in an error message stating it can not find the object without the ID I have looked over hundreds of forums and all over google but can find anything that simply tells me how to have a link that passes data using the post method Plz help
-
Jquery Slider
Hi, I am playing around with web sockets and the HTML5 canvas, I am trying to use a jQuery slider to allow the user to change the line width but i am having a bit of trouble. I have the slider working like so $("#slider").slider({ min: 1, max: 10, 'slide': function(e, ui){ var slideValue = $('#slider').slider("value"); } }); However I am not sure how to run the slide function and get the value when declaring the line width So far I have CanvasSettings.ctx.lineWidth = slide(); however i know that's not right, can anyone help me get the slider value into the line width every time its changed Thanks