Jump to content

denny911

Members
  • Content Count

    88
  • Joined

  • Last visited

Community Reputation

0 Neutral

About denny911

  • Rank
    Newbie
  • Birthday 03/11/1983

Profile Information

  • Location
    Bosnia and Herzegovina
  1. Thank you very much!How can I use an array (located in lets say config file) in multiple functions in my functions.php file.like this: // config file$keywords = array('chicago', 'dallas', 'washington'); and usage in function file: // the array with the same values like the above should go here, but i need it in form of a variable pulled from config file// so similarly i can simply use it in another function$needles = array(); // need values from keywords array located in config file hope you understand what i wantEDIT: the problem is that i cant even print that external variable ($keyword) anywhere in my function.if i try to print it outside a function, it is printed fine.can this be resolved somehow?
  2. this is great, but i decided to change the approach. i wont use sql query, i'll just utilize $_get stringso, i managed to do this:$string = $_GET['string']; if($string) { $haystack = $string; $needle = 'washington'; $pos = strpos($haystack,$needle); if($pos === false) { // string needle NOT found in haystack print "string not found"; } else { // string needle found in haystack print "string found!"; } now, this needs some tweaking$needle should be an array of values (let's say: washington, chicago, dallas, ohio)and IF ANY OF THEM is found in the $haystack, execute the codeany suggestions? thanksP.S. One more VERY IMPORTANT thing: this string comparison should be CASE INSENSITIVE,or $haystack string to be lowercased (if this is a word? )
  3. Hi,could (something like) this be shortened or in any other way made more efficient:(not the real code, just an idea) $string = "something,stuff,thing,whatever";$exploded = explode(',',$string);$item1 = $exploded[0];$item2 = $exploded[1];$item3 = $exploded[2];$item4 = $exploded[3];$sql = mysql_query("SELECT * FROM someTbl WHERE sth LIKE '%$item1%'OR sth LIKE '%$item2%'OR sth LIKE '%$item3%'OR sth LIKE '%$item4%' ";.... since this is only a presentation, the code probably has errors or something,but i'm sure you have a basic idea what i'm trying to achieve.but i think there might be better way for doing this, since i plan to be adding morewords (items) in the string later onso, maybe using an array? please post, thanks
  4. denny911

    Transparent Graphics

    try this:<?phpif($page="default") { print 'style="opacity:1.0;filter:alpha(opacity=100)" '; }else{ print 'style="opacity:0.6;filter:alpha(opacity=60)" '; }?>
  5. Hello,I'm experimenting with AJAX and very thrilled with its possibilites. But..One thing about it made me disappointed. Here's some kind of scenario from yesterday:I wanted to put a small section with several database inputs which will beserved via AJAX page.So i had, lets say, my /index.php page, ajaxPage.js and finally ajaxFetched.php pageObviously, I needed an MySql connection. it was already included in /index.php but apparentlyAJAX page didn't pay much attention to it. It required a connection of its own. So, i tried to includethe connection within it. It didn't work. SO I HAD TO TYPE THE CONNECTION WITHIN THAT AJAX PAGE(page that is called by .js script and serves those database rows to the /index.php page)That's was a kind of workaround that is fairly acceptable for me. BUT (again)..Today i was playing with Yahoo's YUI examples. I stumbled upon their carousels and wanted to applyone to my site. I got it working just fine. But, i wanted to make it more suitable for my needs.I wanted to have several links (something like tabs) above the carousel that are AJAX driven so visitors can switch fromone category to another (that is, have one carousel showing several categories, one at the time)The only problem seems to be: AJAX page needs to load 2 .js files (constructing) and 2 .css files, butsome of them don't load. The end result is in the carousel not showing horizontally and not being CSS formatted, but rather shown vertically (because it basically an ordered list)I know that the code is OK, because when i run that AJAX page directly on my localhost:http://localhost/myajaxpage.php?q=test carousel works perfectly, but when it is supposedto show on the top of my /index.php its scrambled.I tried many things, from putting all of the mentioned files in my /index.php page, to reorganizing linesof code hoping that the files will be pulled anyway.to summarize:Can I force AJAX page to have that 4 files loaded? Is this issue commonly known and if so, whats thesolution? Can i make it to load / use those files if they are included in /index.php?Thanks!
  6. well, i should've known from the start, it was pretty much obvious that the problem wasrelated to paths. one more reason for that was the fact that this worked on my localhostand not on my web server (probably the two have different settings for paths)i carefully inspected everything, put my ajax served PHP file in the root (to avoid trickypath setting), and that solved the problem finally (at least, seems to be so)thank you for your help and pointing out what you've noticed. that's been very helpful!have a nice day,regards from bosnia h.// Denis
  7. my friend, thanks for the effort you put in thissuddenly, the damned thing works in FF but still shows error and doesnt work in IE7 (probably IE6 too)i was messing something about paths (after your posts i became suspicious about them) and somehow fixed it for FFcan you repeat the same as previous now and tell me if there's any difference now (what can you tell me about showUser.js now)thanks
  8. i'm not experienced with javascript nor with the error consolewell, if showUser() not being defined is the case, how do you explain everything working onmy localhost? is that normal?this is showUser.js script:var xmlHttp;function showUser(str){ xmlHttp=GetXmlHttpObject();if (xmlHttp==null) { alert ("Browser ne podrzava HTTP Request"); return; }var url="ajax/subjektiTop.php";url=url+"?q="+str;url=url+"&sid="+Math.random();xmlHttp.onreadystatechange=stateChanged;xmlHttp.open("GET",url,true);xmlHttp.send(null);}function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText; } }function GetXmlHttpObject(){var xmlHttp=null;try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); }catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } }return xmlHttp;}
  9. hmm, that f_id is the argument needed by AJAX page (there's an sql query that isexpecting it via $_GET variable, to know what rows to serve)dont think anything beside what's already happening (and that's links not working)would happen.I wonder whether there is a way to send that parameter (id number) using onclickevent - that is, what is the correct way to form a link
  10. dont think sonotice single quotes on the beginning, after "print", so that does not interfere with doublequotes and therefore they dont have to be escapedIf im wrong, someone correct mebesides, everything works on localhost
  11. Hello to all,Here's the link to my site: www.poslovni-adresar.baI decided to set up a small section for displaying several inputs from my databaseI tried to implement simple AJAX page to do the job (i slightly changed w3schools ajax mysql+php example to suit my needs)On my LOCALHOST everything works just fine (FF 3.0, IE7 and IE8) but it made me quite disappointedwhen i noticed it doesn't work on my web serverIt seems this part of the code is the problem: while($row = mysql_fetch_array($result)) { print '<div class="subjekt"><a onclick="showUser(\'' . $row['f_id'] . '\')">'; print substr($row['_F_IME'],0,30) . '</a>'; if(strlen($row['_F_IME']) > 30 ) print ' ...'; print '</div>';} the part in parenthesis after showUser: showUser('12345') seems to cause the problem.the difference between my code and tutorial's code is that tutorial contains example with form drop downand action is triggered via onChange event. since i wanted to use text link, i didn't know what to use besideonclick event. maybe there should be something else?i tried adding href="#" but it doesn't solve anythingalso, adding "return" before showUser does nothinghow is it possible for this to work on my localhost and to NOT WORK on my web server?Thanks in advance
  12. this is getting more and more frustrating.. even your code doesnt work.it may be the installation that is set up wrong. I already have the .ini file and im able to write to it but that your line of code just doesnt seem to work!Any other suggestions? Consider that the 4 lines of code (from my 1 post) are excerpted from the Joomla test site and they work! I know that because the .ini file is the same for MY site and that TEST site (the test site belongs to my hosting provider - they gave me access to it so i could set the .ini file up myself).but i just dont know why nothing works? Help please!
×
×
  • Create New...