Jump to content

V

Members
  • Posts

    307
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

V's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Thanks Barand! The code works nicely
  2. I'm having trouble rounding time For example I have 01:08:34 and I want to round it to the nearest quarter (and eliminate seconds). I should get 01:00:00 or 01:41:00 to 01:45:00 I'm using the following code but it doesn't work $time = strtotime("01:08:34"); $round = 15; $rounded = (round($time * 60 / $round) * $round) / 60; echo gmdate("H:i:00", $rounded); The output is 01:08:00, the same time not rounded. Please advise me how to do this right.
  3. Nano.. you're a genius! That actually works!
  4. I'm trying to achieve this with my blog entries where the date will always be on the bottom. http://i.imgur.com/e9xZa.jpg I tried this http://jsfiddle.net/RUSm3/ but as you can see the date overlaps the image. Is there a way to push the date to the right of the image? Also, there are blog entries without images where the date should be in the far left. I'm trying to achieve this without php. Does anyone have any idea how to make this work?
  5. After reading about eval() disadvantages I decided not to use it. Anyways this is my script for the ad rotation. Most variable values will be defined dynamically by the user but for the sake of testing I already added values. I'm also using a selection list to test all ad types. <script type="text/javascript">$(function() {$('#affiliates').change(function() { //selected affiliate from list var affiliate_id = '12345678'; //adsense publisher id or other affiliate id switch (this.value) { case 'adsense': //ad styling and affiliate id ad_options = 'google_ad_client = "pub-' + affiliate_id + '"; google_ad_width = 160; google_ad_height = 600; google_ad_format = "160x600_as"; google_ad_type = "text_image"; google_color_border = "000000"; google_color_bg = "ffffff"; google_color_link = "0066CC"; google_color_text = "000000"; google_color_url = "3D81EE";'; //javascript tags and external ad script ad_js = '<scr'+'ipt type=\"text/javascript\"><!--' + ad_options + '//--></scr'+'ipt><scr'+'ipt src=\"' + window.location.protocol +'//pagead2.googlesyndication.com/pagead/show_ads.js\" type=\"text/javascr'+'ipt\"></scr'+'ipt>'; break; case 'amazon': //ad styling and affiliate id ad_options = 'amazon_ad_tag = \"xxxxxxx-xx\"; amazon_ad_width = \"160\"; amazon_ad_height = \"600\"'; //javascript tags and external ad script ad_js = '<scr'+'ipt type=\"text/javascript\"><!--' + ad_options + '//--></scr'+'ipt><scr'+'ipt src=\"' + window.location.protocol +'//www.assoc-amazon.com/s/ads.js\" type=\"text/javascr'+'ipt\"></scr'+'ipt>'; break; }//generate ad code in ad_slot div $('.ad_slot').html(ad_js); });});</script> then the HTML... <select id="affiliates"> <option value="0">Select Affiliate</option> <option value="adsense">adsense</option> <option value="amazon">amazon</option> <option value="other">etc</option></select><div class="ad_slot"></div> So if for example I select "Amazon" from the list, this code should appear in the "ad_slot" div. <script type="text/javascript"><!--amazon_ad_tag = "xxxxxxxxx-xx"; amazon_ad_width = "160"; amazon_ad_height = "600";//--></script><script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"></script> I need to maintain the exact code format as generated on amazon.com or adsense. The issue is, values (like amazon_ad_width, amazon_ad_height, etc) aren't being sent in the external js.
  6. Hmm, I'll put the script together and I'll post it, it's difficult to explain. It's a very short script.
  7. Oooh eval() executes strings, it seems to be what I need! Thanks Crayon! Sorry for not explaining the whole thing, I didn't want to overwhelm. In short, it's for an ad rotation script that displays various ads (Amazon, ebay, adsense, etc). You can choose which type of ad you want to display (I do this in js with switch statements) and each ad has it's own affiliate id. So my script loads the codes that belong to a certain ad type the user chose to display. (I don't use the db for the entire code, just for unique affiliate links) The reason I want to put the whole code in 1 variable string is because I want to maintain the original ad code format so I don't violate any policies. Adsense for instance prohibits alteration of their code. lol that wasn't very short, not sure if it makes sense. I'm certain there must various way to achieve that, maybe I'll figure out a smarter way once the script starts working. Sorry for the double post.. it seems there's no way to delete it.
  8. Oooh eval() executes strings, it seems to be what I need! Thanks Crayon! Sorry for not explaining the whole thing, I didn't want to overwhelm. In short, it's for an ad rotation script that displays various ads (Amazon, ebay, adsense, etc). You can choose which type of ad you want to display (I do this in js with switch statements) and each ad has it's own affiliate id. So my script loads the codes that belong to a certain ad type the user chose to display. (I don't use the db for the entire code, just for unique affiliate links) The reason I want to put the whole code in 1 variable string is because I want to maintain the original ad code format so I don't violate any policies. Adsense for instance prohibits alteration of their code. lol that wasn't very short, not sure if it makes sense. I'm certain there must various way to achieve that, maybe I'll figure out a smarter way once the script starts working.
  9. @Crayon thanks for the code but I'm not exactly sure how to use it. Adding the js to a div is the only way I can achieve what I need to. It's a bit long to explain but ultimately I'm trying to figure out how to put that entire code in a variable. Also, the vars are already global I believe because I didn't use "var" when defining them.
  10. I'm creating an ad rotation script and trying to store this code.. amazon_ad_tag = "xxxxxxxxxxx-xxx"; amazon_ad_width = "160"; amazon_ad_height = "600"; as a global js variable. I'm not getting errors but values are missing when loading Amazon's script that displays the banner. This is how I inserted the code into the variable's value. I think that I did it wrong.. :-\ advert_options = "amazon_ad_tag = \"xxxxxxxxxxxx-xxx\"; amazon_ad_width = \"160\"; amazon_ad_height = \"600\";"; I use the "advert_options" variable to produce an Amazon banner, for example... <script type="text/javascript"> $(document).ready(function(){ advert_options = "amazon_ad_tag = \"xxxxxxxxxxxx-xxx\"; amazon_ad_width = \"160\"; amazon_ad_height = \"600\";"; $('.ad_slot').html('<scr'+'ipt type=\"text/javascript\"><!--' + advert_options + '//--></scr'+'ipt><scr'+'ipt src=\"' + window.location.protocol +'//www.assoc-amazon.com/s/ads.js\" type=\"text/javascr'+'ipt\"></scr'+'ipt>'); }); </script> <div class="ad_slot"></div> The output in the "ad_slot" div should be <script type="text/javascript"><!-- amazon_ad_tag = "xxxxxxxxxxxx-xx"; amazon_ad_width = "160"; amazon_ad_height = "600";//--></script> <script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"></script> ...but I get amazon_ad_rcm is not defined Line 372 when Amazon's ads.js script loads. I have missing values I think. My question is, am I properly defining the "advert_options" var?
  11. Thank you for the help everyone! @xeronix, um I think my host provider has that :/
  12. I'm planning to learn how to create membership sites. For example members can get certain features if they sign up with a plan. Besides adding "subscribe" buttons is there a way to integrate Paypal with Mysql? Maybe if a member subscribes, update their "member" column with a "subscribed" status and then with php activate premium options if the user is subscribed. Is this sort of integration possible with Paypal?
  13. I'm trying to append something to a div that was already appended but it doesn't seem to work.. :-\ This is the code (I'm not using line breaks in the js). I'm using it to create text inputs when I click a button. $(document).ready(function() { var fieldCount = 0; $('.add_text_input').click(function() { fieldCount++; $('li').append('<div class="editLabel" id="' + fieldCount + '">Untitled</div> <div class="formField"></div> / <input type="text" name="untitled' + fieldCount + '" id="textinput' + fieldCount + '" /><br />'); }); $('.editLabel').click(function() { var fieldLabel = $('.editLabel').html(); $(this).hide(); $('.formField').append('<input type="text" name="untitled" value="' + fieldLabel + '"/><br />'); }); }); When I click the input field's label "Untitled" (which is in the editLabel DIV), I want to hide it and append an input field in the empty formField DIV which I'll use later to edit the default label "Untitled". The problem is, nothing happens on click.
  14. Thanks MadTechie I think the API concept is starting to make sense
  15. Please help me with some guidance. I want to allow users to create their own html forms by choosing different form elements (textfields, textareas, lists, ratios, etc) I guess something similar to http://wufoo.com/ but much more basic. I'm having some trouble deciding which approach I should take. Database tables or files? For tables I was thinking to create a table for each form element, e.g TEXTFIELD TABLE ID TEXTFIELD_NAME USER TEXTAREA TABLE ID TEXTAREA_NAME USER etc for all form elements and then just query all of them with.. WHERE user=$user Or should I generate php files on the server for each form created?
×
×
  • 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.