Jump to content

matfish

Members
  • Posts

    242
  • Joined

  • Last visited

Posts posted by matfish

  1. Using the code from my previous post, I've got that working.

     

    But another form of XML I'm dealing with is:

     

    <xml>
    <item Mon="9:00am" />
    <item Tue="9:30am" />
    <item Wed="10:00am" />
    </xml>

     

    I'm trying to get the node/variable name of "Mon/Tue/Wed" into an array alongside it's time in a loop?

     

    Any ideas?

     

    Thanks for your help.

  2. I think I'm getting my head around it now.

     

    I'm currently using:

     

    $xmlstr = <<<XML
    <xml>
    <item id="1" body="content 1" />
    <item id="2" body="content 2" />
    </xml>
    XML;
    
    $xml = new SimpleXMLElement($xmlstr);
    
    foreach ($xml->item as $data) {
        echo $data['id'].": ".$data['body']."<br />";
    }

     

    Many thanks

  3. Hi there,

     

    The usual way I use XML is using:

     

    <xml>
    <item>
    <id>1</id>
    <body>content 1</body>
    </item>
    <item>
    <id>2</id>
    <body>content 2</body>
    </item>
    </xml>

     

    However I'm having to pull the content from a CMS which is out of my control which uses:

     

    <xml>
    <item id="1" body="content 1" />
    <item id="2" body="content 2" />
    </xml>

     

    Is there a way to parse and loop through this type of XML formatting easily and put into a PHP array?

     

    Thanks in advance!

     

  4. Hi there,

     

    I have Russian content as an Excel spreadsheet to import into a database. I have converted it to .CSV but it does not recognise the Russian characters and replaces with question marks.

     

    Is there another way to import the spreadsheets? Or a way for the CSV to understand the language?

     

    Many thanks

  5. Hi there,

     

    I need to produce an XML file which is outputting French characters, which then feeds a Flash application.

    However, I can't seem to output uppercase French special characters (lowercase seems fine)

     

    I'm using the UTF-8 header.

     

    Any suggestions?

    Many thanks

  6. Hi there,

     

    I have a shopping basket which I'm trying to add up in JS depending on which delivery method the customer chooses, however I have values such as 1,200 + 25.00 but I keep getting "NaN" when trying to add them

     

    I have a feeling it's the larger values - any help?

  7. Hi there,

     

    the code I have so far is:

     

    <script>
    
    function showDiv(){
    if($('#YourDiv').is(":visible")){
    	$('#YourDiv').hide();
    }else{	
    	$('#YourDiv').show(function(){
    		$('.fullWindow').click(function(){
    			$('#YourDiv').hide();				   
    		});
    	});
    }//
    }//showDiv()
    
    </script>
    

     

    I'm not sure how to use bind yet so when the .fullWindow (which is a div around the whole page) is clicked it hides the Div overlay and doesn't let me action a click within the Div.

     

    Also, there seems to be a bit of a transition/animation where it slides down rather than just showing immediately. Any idea how to remove the animation?

     

    Thanks for your help

  8. There is a close button, but customer feedback and analytic's are showing they are clicking on the white area of the body of the page rather than clicking the close button. Stupid people.

     

    I'll check out binding... thanks

  9. Hi there,

     

    I'm using JQuery to click "View Basket" which an DIV overlay then appears with your items in the div.

    I'm also using a body onclick so you can click anywhere on the page which then hides the basket.

     

    But I've added links in the Div Overlay now so you can remove an item from the basket, but the body onclick kicks in and just hides the Div again.

     

    Any ideas how I can click anywhere on the page to hide the Div overlay but also have the functionality to click a link within the Div and not hide the Div?

     

    Many thanks

  10. Hi,

     

    Yes Yes, I know, IE6 sucks big time. Not only do you need a stylesheet to place everything properly but my other big issue is that it's crashing with my Javascript.

     

    It works in all browsers, yes - even IE7&8, but the client is requesting it needs to be fixed for IE6 for the time being.

     

    I'm using JQuery for simple image roleovers, fading in/out and the main one I guess is for it's Ajax query. But everytime it runs the Ajax the whole thing crashes.

     

    I was just wondering if anyone has any input before I start pasting code for you to view?

     

    Many thanks

  11. I've altered to suit what I needed and seems to work now:

     

    <script>
    function strstr (haystack, needle, bool) {
        var pos1 = 0;
        haystack += '';
        pos1 = haystack.indexOf( needle );
    
        if (pos1 == -1) {
            return false;
        } else{
            if (bool){
                return haystack.substr(0, pos1);
            } else{
    		amp1 = haystack.indexOf('&');
    		if(amp1>pos1){
    			return haystack.slice(pos1,amp1);
    		}else{
    			bString = haystack.slice( pos1 );
    			pos2 = bString.indexOf( needle );
    			amp2 = bString.indexOf('&');
    			return bString.slice( pos2, amp2);
    		}//if(amp>1){
            }//if (bool){
        }//if (pos == -1) {
    
    }//function strstr
    
    var string = strstr("thisisatest.com/index.php?variable1=1234&variable2=4321&variable3=000", "variable1=");
    
    alert(string);
    
    
    </script>

     

    If anyone does know a simpler way, I'd be interested.

     

    Many thanks

  12. I currently have the code:

     

    <script>
    function strstr (haystack, needle, bool) {
        var pos = 0;
        haystack += '';
        pos = haystack.indexOf( needle );
    
        if (pos == -1) {
            return false;
        } else{
            if (bool){
                return haystack.substr( 0, pos );
            } else{
    		amp = haystack.indexOf('&');
    		if(amp>pos){
                	return haystack.slice( pos, amp );
    		}else{
    			return haystack.slice( pos );
    		}//if(amp>1){
            }//if (bool){
        }//if (pos == -1) {
    
    }//function strstr
    
    var string = strstr("thisisatest.com/index.php?variable1=1234&variable2=4321&variable3=000", "variable2=");
    
    alert(string);
    
    
    </script>

     

    If i change the variable2= in the strstr function to variable1= then it works, but not if I use variable 2 or variable 3. I guess this is something to do with the & being in seveal places?

  13. Hi there,

     

    JS newbie and trying to use JQuery, is there a way to do the following (having to write in pseudo code so you know what I'm trying to do...) (oh, and I'm dealing with iFrame issues - something I have to do for this project)

     

    top.location.href="http://www.domain.com/directory/?foo=1234";

    if(top.location.href contains "foo=1234variable"){

      openPopup('1234variable');

    }

     

     

    So basically, use JQuery to get the full URL and IF there is a foo variable then open the ID 1234 in my popup?

     

    Many thanks

  14. Hi,

     

    Long story but I have a client of which they want a site built on one server and pulled in through a dreaded iFrame.

     

    Along with that,  obviously this then works as two sites. One viewed from the iFrame and one viewed directly on the server it's hosted. Is there a way to determine if your in the iFrame or on the server? For example, if they are viewing via the iFrame then leave things as they are, however if they are viewing on the server-part without the iFrame then display:block (css) the header?

     

    Many thanks

  15. Hi there,

     

    I've recently moved server and it seems to be working differently. Not sure if anyone knows the reason I can change on the server (it's dedicated so I can change) to save changing my site structure...

     

    I have a rewriterule of the following: RewriteRule ^blog/([^/]+)$ /blog/blog_detail.php?rewrite=$1 [L,NC]

    which gives me "nice URLs" but now the directory /blog/index.php doesn't work? It's like index.php is being passed as the rewrite=$1 variable...

     

    Did that make sense?

     

    Any help would be appreciated.

     

    Many thanks

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