
V
Members-
Posts
307 -
Joined
-
Last visited
Never
Everything posted by V
-
Thanks Barand! The code works nicely
-
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.
-
Nano.. you're a genius! That actually works!
-
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?
-
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.
-
Hmm, I'll put the script together and I'll post it, it's difficult to explain. It's a very short script.
-
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.
-
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.
-
@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.
-
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?
-
Thank you for the help everyone! @xeronix, um I think my host provider has that :/
-
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?
-
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.
-
Thanks MadTechie I think the API concept is starting to make sense
-
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?
-
Yes, just insert into the DB and query from the DB
-
MadTechie yes that makes sense. I'm just trying to find a very basic API example using the REST method and from then I can figure out how to develop my own. There's no (easy to understand) documentation on it, yet everyone says it's simple..
-
Use Photoshop or any other program that has a eyedropper tool to get the color codes from images.
-
Ignance thanks for the example! However I have no idea how to use that. I'll try and request a REST tutorial on the boards
-
dreamwest thanks, that's the simplest API explanation I saw Is file_get_contents like CURL?
-
Oooh I see! Thanks! Do you know where I could find some REST examples? Verything API related seems to be Twitter or Facebook..
-
Yes, I have control on the other sites just for the variable.
-
I'm trying to learn how to create a simple API, possibly using REST. I found a lot of online tutorials on how to implement API's but how do I create my own for my own website? The API I want to make is just for querying simple data and inserting data in the DB. From what I learned, REST does HTTP requests from a XML or JSON file but is REST a script I have to download, I can't find a REST site. I'm confused.. :-\
-
@hoogie thanks for the reply! That makes sense I should probably think of a way to automatically create a non-existing variable. @kenrbnsn, I'm trying to send URL requests to some websites but their URL may vary in parameters. One might be ...somesite.com?existing_var=1234 or somesite.com?existing_var=1234&another_var=789 so I'm trying to figure if I can add for example, ?my_var=345 at the end of any link without getting script errors and successfully using GET on the sites I added the new parameter.
-
Is it possible to add a query string for example some_var=jk84 to any sort of link be it, http://www.website.com , http://www.website.com/?some_id=4, or http://www.website.com/post=45&category=9 or http://www.website.com/somepost/ ? While adding that extra query string how can I make sure I'm not affecting the website's content or causing some script error?