Jump to content

maxxd

Gurus
  • Posts

    1,655
  • Joined

  • Last visited

  • Days Won

    51

Posts posted by maxxd

  1. I am trying to change the background color of the cell of the table, not the background color of the dropdown. 

     

    Then this is a simple JavaScript question, not a PHP question. Create an change event handler to change the background color to the value selected by the user. Note that 'amber' is not recognized by Firefox as a valid color, so you'll probably want to do hex values, but this should get you started:

     

    HTML:

    <tr>
    	<td id='capacity_cell' style='width:300px;height:250px;background-color:grey;'>
    		<label for='capacity'>Capacity</label>
    		<select id='capacity'>
    			<option value=''>Select One</option>
    			<option value='green'>Green</option>
    			<option value='amber'>Amber</option>
    			<option value='red'>Red</option>
    			<option value='black'>Black</option>
    		</select>
    	</td>
    </tr>
    

    jQuery:

    $(function(){
    	$('#capacity').change(function(e){
    		var bg = $(this).val();
    		$('#capacity_cell').css({
    			backgroundColor: bg
    		});
    	});
    });
    
  2. Possibly more importantly, there is a lot of redundant and inefficient code in what you've posted. First and foremost, don't simply 'SELECT *' from a table when you only need three columns. Specify the columns you need. Also, you're running the same query twice. Don't. Run the query once to get the values, store the values in an array, and loop through the array twice. On top of that, you're including the database.php file three separate times. You are at lease using require_once(), but why take the time to do the extra typing? Include the external file at the top of this file and you're good to go.

     

    I'm in the same boat as cyberRobot here - until you explain a bit more thoroughly what exactly you're trying to do, we're not going to be able to help you find the correct answer.

  3. That could be many things, but we won't know for certain until we get some details from you and see some of the code you've written. There are many, many tutorials out there - some are good, some are not. With the information you've given, we have no way of knowing which kind you're attempting to follow. First thing to come to mind is did you format the comment section at the top the file correctly? Also, the plugin won't show on the dashboard page, you'll have to activate it through the Plugins page first - is that where it's not showing up? Do any other plugins show up on the Plugins page?

  4. If you've got the tables joined, wouldn't you just name the columns in the match?

    SELECT   items.*
            ,type_1.*
    FROM items
    LEFT JOIN type_1
        ON items.type_1 = type_1.type_1_id
    WHERE MATCH(items.item_title, type_1.type_1_name ) AGAINST('$search_query' IN BOOLEAN MODE) ORDER BY items.item_id DESC LIMIT {$limit} OFFSET {$offset}
    

    I'm assuming you're validating and sanitizing the variables you're injecting into the query, yes?

  5. The buttons across the top of the post area here are courtesy CKEditor. You would use this or TinyMCE (for instance - there are many, many other options) as the user editor. The resulting user-entered string (html included) is sent to your processing script upon form submission. That's what you would store in the database and present to the user on page load. There's no need for character counts, character positions, or concatenation. Sanitize the string, store it, retrieve it, escape it, and display it. Much simpler.

  6. Your DreamWeaver error message is telling that the site definition is incorrect. Go to Site > Manage Sites, select your site definition in the list, and click the edit button. You'll want to select the 'Servers' panel, select your server in that list, and click the edit button once again. There, update your server location, default path, username, and password, and click 'Test'. This will let you know whether or not the information you entered is valid and able to be used by DW.

  7. While you're following NotionCommotion's advice, look to see if Chrome and Safari are passing the submit button as part of the $_POST data. They probably are, but may not be. If not, you can remove the checks for that and replace it with

    if($_SERVER['REQUEST_METHOD'] == 'POST'){
    

    @benanamen just beat me to it... :)

  8. That's great.  Now my next question is, how do I echo all 100 of those a href links outside the for loop?

     

    You could run another for() loop, or a foreach() loop. For instance:

    <div class='links_aggregate'>
    <?php
    foreach($pages as $p){
    	print($p);
    }
    ?>
    </div>
    

    Or, if you're gathering the data at the point in the page where you need to output the links, simply print() or echo() them there instead of assigning them to an array.

     

    Heck, if you don't care about source readability, you could simply output an implode() on the array

    echo implode(' ', $pages);
    

    That last one hasn't been tested and is the product of a couple beers, so take it with a grain of salt.

  9. I really don't mean to sound mean, but it sounds as though yes - you are totally in over your head. You don't trust the security of the established CMSs out there, so you decide to write one yourself after one course in PHP/MySQL? It doesn't matter what the users you're targeting are capable of, the site will be available on the Internet. Not just your target audience will be able to access it, even if it's password protected. In this case (and believe me, I never thought I'd be saying this) you might be better off using WordPress.

     

    Take a few more courses in PHP and MySQL, put together some sites on your local machine, ask some questions, and continue to learn, and I certainly hope you'll build a WP killer; but from what it seems like you're asking I'm not even sure you've got the basics of how and why to use a database under your belt yet, let alone how to protect not only the server upon which you're hosting the site, but the users that will possibly be using that site.

    • Like 1
  10. 'page' is defined as "The page number to show". 'per_page' is defined as "Number of items to show on each page. Max 50.". There's also an 'offset' key, which according to the documentation you shouldn't supply. The assumption here would be that 'page' and 'per_page' work together for paginated search results; for instance, to show videos 51-101 of user 1577007's playlist, you would call to 'https://api.vimeo.com/users/1577007/feed?page=2&per_page=50'.

     

    Of course, when you do that in the playground, you're told that "The user is not allowed to perform that action." Which means there must be more to it - perhaps you need an API key, or perhaps you can't just pull a random stranger's playlist.

     

    If you select 'likes' on the same user, though, you do in fact get some data back, so I'm thinking you may need the user's specific permission to grab his or her feed contents, but that same user's likes are public.

     

    Regardless, your best bet is to start by reading the documentation and experimenting with the playground API they've set up.

  11. One course on PHP isn't going to cut it for you in this situation. As you've already seen, the CMS handles hashing the passwords, so let it. It probably handles assigning user roles as well. Let it do that, too. It's a content management system specifically so that you don't have to manage the content directly. Let it do it's job, and your hair will stay where it's meant to be a lot longer than otherwise.

  12. Why would you replace the source attribute of an image with your telephone number? It sounds like you're looking for the anchor tag, in which case you're looking at the wrong code. Look for where the template outputs or assigns to a variable "<a href='https://domainnamehere.co.uk'>" - that's the line you're wanting to change.

     

    Although, looking at the little bit of code you've supplied, I'm not exactly sure how your theme is handling this. It's outputting both mobile and desktop versions of the image, and I assume using CSS media queries to display or hide the appropriate image. Check to see if the theme developers have added a filter at the point where the home link's href attribute is output in the template file (I assume you're in header.php).

×
×
  • 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.