Jump to content

gerkintrigg

Members
  • Posts

    830
  • Joined

  • Last visited

Everything posted by gerkintrigg

  1. Hello. A few years ago, I spent ages working on a way to replace multiple substrings within a large body of text. I can't remember what I did, where I stored the code or how to do it, so I was hoping you could help. I want to take a large body of text and replace keywords from within the text with links to a page about that topic in a similar way to wikipedia. Is there an easy way of doing this without manually adding the links? Bear in mind that the database will grow quite a lot and so str_replace is probably going to be innadequate. Thanks. Neil
  2. This is driving me bonkers! I want to be able to dynamically change the value of a text field using this function: function popup_blanket(ID2Delete) { document.getElementById("blanket").style.visibility = "visible"; document.getElementById("confirmation_centre_screen").style.visibility = "visible"; //alert('ID: '+ID2Delete); document.forms['DeletePageForm'].elements['Page2Delete'].value=ID2Delete; } Then I will simply call it using this link: <a href="javascript: popup_blanket(<?php echo $rpages['page_id'];?>)"><img src="<?php echo $root;?>furniture/delete.jpg" alt="Delete This Page" width="30" height="30" border="0" title="Delete This Page" /></a> The problem is that the value of the text box is not responding. I have set up a test alert to check that the function is being called correctly (now commented out above) but that worked fine. What am I doing wrong?
  3. thorpe, As always, I bow to your superior intellect. It works great. The final script can be seen at http://ghostlypublishing.co.uk/members/admin/mailing_list/admin/ All the best, gerkintrigg
  4. Hello. I think I have worked out where my problem lies, but have no clue how to fix it. I'm posting the first name, surname and email to a newsletter signup script I found online. The original script only used the email address, but I wanted to make it a little more dynamic (a bit like aweber in that it can accept [fname] and replace it with the name from the database). Everything works except actually inserting the fname and sname variables into the database. (I was testing it using the SQL back end, originally). I have tracked the issue to a Javascript snippet which originally said this: data: 'email=' + $('#email').val(), // data to post Thinking logically (or not), i changed it to this: data: 'email=' + $('#email').val()+ 'fname=' + $('#fname').val()+ 'sname=' + $('#sname').val(), // data to post This was initially just to prove to myself that the data is there and being passed to the script... it is, but it currently outputs like this: email@email.comfname=firstnamesname=surname Could someone please let me know what I'm doing wrong. I'm fine with PHP, but to say that I "muddle through" the javascript aspect is probably about right.
  5. If I were to do it, I'd use a while loop to output all records that match your criteria and probably skip some of the echo stuff and just have something like this: ?><a href='curso_guitarra.php'><img src="<?php echo $dados['image_curso'];?>"/> <br /> <?php echo $dados['nome_curso'];?></a><?php that way you will be able to see the format of the data in your program (like Dreamweaver) to make sure that any errors you have is in the PHP and not basic HTML formatting (which can be very messy in tables, the way you're doing it). Just a thought and it might help.
  6. it should be pretty simple to do. Have a look on W3Schools (Google it... W3 Schools) but to be honest, I may be confusing a simple question... but I'm not sure I really know what the problem is. Is it just a case of the options needing to be in a select command? the neatest way of doing it might be to use an array in the PHP, but it sounds like this might be a HTML issue rather than a PHP one.
  7. I understand the round corner command in CSS and it works when I use it like this: .round_corner_image{ -moz-border-radius: 15px;; border-radius: 15px; margin:2px; } My question is how to make a box like the logo here: http://ghostsinplymouth.co.uk/furniture/small_logo.jpg I want to make a box in CSS which has the same shape as the rusted metal and figured it's probably possible in CSS 3. I've tried negative values but that doesn't work. Any suggestions? Thanks.
  8. Hello, I'm trying to work out how to align the text search box with the search button on http://www.sary.co.uk The thing is that it works in rockmelt but Internet Explorer's having issues... so I sort it for IE and rockmelt displays it wrong. I need something that'll work for all browsers. Any ideas? I've currently got these styles applied to the form elements: .go_btn { border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; background-image: url(furniture/go_btn.jpg); background-repeat:no-repeat; border-top-width: 3px; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 0px; border-top-color: #F06; border-right-color: #F06; border-bottom-color: #F06; border-left-color: #F06; height:25px; width:38px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: bold; font-variant: normal; text-transform: capitalize; color: #FFF; text-decoration: none; position: relative; left: -2px; } .search_box { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: bold; font-variant: normal; text-transform: none; color: #000; background-image: url(furniture/search.jpg); background-repeat: no-repeat; height: 17px; padding-left: 25px; border-top-width: 3px; border-right-width: 0px; border-bottom-width: 3px; border-left-width: 3px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #F06; border-right-color: #F06; border-bottom-color: #F06; border-left-color: #F06; }
  9. Ah! it works. To reply directly to your points: 1) Yes. 2) D'oh! 2) Sorted. Thanks very much. )
  10. 1) I should have a rewrite engine - I do on other sites on the same server, but this site is very new and I have to admit that I never used it before. 2) The URL I'm trying to match is http://www.sary.co.uk/products/2_Product-2.html to http://www.sary.co.uk/products/reader.php?id=2 3) This should now be a working URL - I know I had a small code error in the destination URL, but that shouldn't have effected the mod re-write rule.
  11. I dunno whether I'm being stupid here, but I have this rewrite rule and I have no idea why it's just not doing anything (at all) RewriteRule ^products/([^/\.]+)?$ http://sary.co.uk/products/reader.php?id=$1.php?id=$1 [L] the error pages work fine, so I think HTACCESS support is live.
  12. I sorted it... http://www.manteya.com/spin
  13. cool, I'll sort that out, then. Thanks.
  14. I'm trying to use a function I saw online called mb_strpos() but I keep getting this error Fatal error: Call to undefined function mb_strpos() Is it a code error or is it just not installed? If it's not installed, how'd I sort that out?
  15. Thanks, it works with the example but it has issues when I use the string in the example below, but I think this is pretty close: $str='this is a [good,strong,hard,easy] test, although I think that [you, me, we] may find it difficult to [use,work with] it.'; $var_start='['; $arr=explode('[',$str); foreach ($arr as $key => $value) { $split=explode (']',$value); $variables[$key]=$split[0]; #define the variable bank that will be replaced by each variable within the bank: if($key!=0){ $variable_bank[$key]=$split[0]; } } foreach ($variable_bank as $key => $value) { $each_var=explode(',',$value); foreach ($each_var as $key2 => $value2) { echo str_replace('['.$value.']',$value2,$str).'<br />'; } } This outputs this is a good test, although I think that [you, me, we] may find it difficult to [use,work with] it. this is a strong test, although I think that [you, me, we] may find it difficult to [use,work with] it. this is a hard test, although I think that [you, me, we] may find it difficult to [use,work with] it. this is a easy test, although I think that [you, me, we] may find it difficult to [use,work with] it. this is a [good,strong,hard,easy] test, although I think that you may find it difficult to [use,work with] it. this is a [good,strong,hard,easy] test, although I think that me may find it difficult to [use,work with] it. this is a [good,strong,hard,easy] test, although I think that we may find it difficult to [use,work with] it. this is a [good,strong,hard,easy] test, although I think that [you, me, we] may find it difficult to use it. this is a [good,strong,hard,easy] test, although I think that [you, me, we] may find it difficult to work with it. I think that if we combined both approaches, we'd probably solve it.
  16. thanks jasonrichardsmith, but I don't seem able to get that to work... I have tried without Preg functions: $str='this is a [good,strong,hard,easy] test, although I think that [you, me, we] may find it difficult to work with it.'; $var_start='['; $arr=explode('[',$str); foreach ($arr as $key => $value) { $split=explode (']',$value); $variables[$key]=$split[0]; #define the variable bank that will be replaced by each variable within the bank: $variable_bank='[good,strong,hard,easy]'; } foreach ($variables as $key => $value) { if($key!=0){ $key--; $var_array[$key] =explode(',',$value); foreach ($var_array[$key] as $key => $value) { echo str_replace($variable_bank,$value,$str).'<br>'; } echo '<br>'; } } It comes close, but doesn't actually output what I need as you can see here: http://manteya.com/test/ It's almost like I need to output the $variable_bank variables as an array together with the $variables to replace the bank with, and then run them all the way through as a for-each type argument. The issue is having more than one variable bank...
  17. Hi everyone! I'm trying to get the variables out of a string like this: $string='this is a sentence with a load of [great, clever, textual] variables '; What I want to do is output a list of strings that have used the variables to create unique strings like this: this is a sentence with a load of great variables this is a sentence with a load of clever variables this is a sentence with a load of textual variables I tried exploding the string into arrays, but what I really need to do is explode on '[' then output the words to an array (until I get to the closing ']') and then move on... The eventual string will have potentially loads of variables, but let's do one thing at a time. What's the best way of starting a project like this? Neil
  18. Im not sure about the output from the feedURL variable (and I'm on my iPhone now so I can't test it) but if you could use echo "<pre>".file_get_contents($feedURL)."</pre>" That would at least tell you what you're dealing with. You may have nested arrays which you can then deal with easily.
  19. Awesome, I'll try that and let you know how it goes.
  20. I know that PHP is server-side, but I wondered whether anyone had a similar issue that they got around... here's my problem... I've made a psycho-analysis tool for Facebook where it runs your Facebook friends through a database of words to get their psychological preferences (that all works)... I then have a link so that users can tell their friends about the service (it's free, so I want to get it to spread virally) but I'm having a few issues with the link... At the moment, it all works from a Facebook point of view, but when they click on the link, it takes them to an almost-blank page with a bit of code on it. I know what this code is and why it's there, but I'd like to hide it behind a branded page, ideally with Ajax. When I tried to use Ajax for it, it wouldn't accept the URL that was sent. The link has to have a URL sent to Facebook like this: https://graph.facebook.com/feed?access_token=149324721793321|HarGd6ioqoroENE9gv2758rfeYY&message=I%27ve+just+psycho-analysed+my+Facebook+friends+using+Manteya%27s+Facebook+Friend+Checker+%28http%3A%2F%2Fwww.manteya.com%2Ffacebook-friend-checker%29+so+that+I+can+communicate+better+with+you.&id=100001925276042 but for obvious reasons, you can't post it as an Ajax variable by using the: http://www.url.com/test.php?id=$variable; Is there a way I can get around the problem? I guess the issue is that Facebook needs the detail in the URL, but PHP won't let me send it like this. I have thought about uploading the URL to a database and shortening the URL, then posting that, which would then re-direct, but that's a messy way around I'm sure you smart people have done something like this before. To see my existing (almost) working example, visit http://www.manteya.com/ffc Thanks, Neil
  21. Will do. But it looks like I am going to have to buy one. Nevermind.
  22. I admire the thought process, but I want the database to double as a stand-alone system on a desktop, so I really need a thesaurus database. I'm fine with multiple tables in a database, but I do need a thesaurus that I can move around and even access without net connectivity (fancy that!)
  23. Hi! I wondered if anyone here knew of a good thesaurus CSV file that I can download, ideally for free, but I may be willing to pay for the right one. Thanks, Neil
  24. I have a lovely RSS creation script which dynamically writes an RSS feed using the information from the database, which you can automatically update every time a blog entry (or anything else generated by a script) is added. The only issue with it, is that the <strong> tags have had to be deleted using strip_tags() because the RSS doesn't like it. I want to keep the original formatting of the blog article but because I have to strip out the strong links, the hyperlinks are also removed. I don't know enough about RSS (IMHO) to work out how to put the links back in - do I need to format the STRONG tags differently, or do i need to change the PHP to str_replace() the strong tags with nothing? Here's some code that does work: <item rdf:about="http://www.manteya.com/blog/Music-Improves-Productivity_24.html"> <title>Music Improves Productivity</title> <link>http://www.manteya.com/blog/Music-Improves-Productivity_24.html</link> <description>Research shows that music can improve speed of working within organisations. There is a double-edged sword to this article, however. Music with fast tempos can help the release of adrenalin and therefore increase the heart rate of the listener. Music producers here in the UK have taken advantage And here's some that doesn't: <item rdf:about="http://www.manteya.com/blog/Music-Improves-Productivity_24.html"> <title>Music Improves Productivity</title> <link>http://www.manteya.com/blog/Music-Improves-Productivity_24.html</link> <description>Research shows that music can improve <strong>speed</strong> of working within organisations. There is a double-edged sword to this article, however. Music with fast tempos can help the release of adrenalin and therefore increase the heart rate of the listener. Music producers here in the UK have taken advantage I'm sure you geniuses (or geniei) can work it out, so any help would be very welcome indeed.
×
×
  • 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.