I have an html document that contains hundreds of special chracters (such as em dashes, smart apostrophes, accent egrave, etc) that I would like to convert to their html equivalents.
For example, my document contains an "em dash" (—), which I would like to convert to:
—
Of course, my html document contains html tags. I do not...
So the convention of using input type submit is this
<input type='submit' value='Submit'>
this will give me a button that says "Submit" on it and inside the post array i will have
$_POST['submit'] = 'Submit'
is it possible to have the submit button to show Submit but have the post value to be different. In other words, I want a but...
What is more efficient
if ($n-1 < $x)
or
if ($n <= $x)
Anyone know?
...
What is the best approach for creating a password-less login system?
I'm thinking to use some sort of randomly generated 16 character token, for example:
mysite/members/index.php?token=2j0n1qyjgcxyu3oy
I'm developing a quotation system and the idea is that the suppliers don't have to register, instead I create their account for them a...
In a multidimensional array, each array has a field 'order'. I need to change this value as follows:
0 -> 3
1 -> 2
2 -> 1
3 -> 0
4 -> 7
5 -> 6
6 -> 5
7 -> 4
8 -> 9
9 -> 8
etc...
Ill be doing this while iterating through the array as follows
$c = 0;
foreach($data['images'] as $i)
{
//$i['order'...
I have a multi-value cck field in a drupal node. The field is called field_multip. I need to know the number of items in this field, for example 3 in the case below
I would have thought that length would do the trick, but neither $node->field_multip.length nor $node->field_multip.length() worked for me.
field_multip
[0]
[id]
...
example:
foreach($boxes as $box) {
echo "$box \n";
}
Used to be fairly easy, I could just wrap the foreach around a check like:
if(is_array($boxes) && count($boxes) > 0) {
//foreach loop here
}
Without having to worry about a warning getting thrown if for whatever reason bad input was passed to the $boxes array.
When...
I'm trying to use hook_search to extend the built in drupal search to explicitly link two content types.
ex. items a and b are part of collection a. Currently if you search for the title of collection a you only get collection a. I'd like to extend the search so that you get items a & b as well because they are members of that collect...
I can't decide which to use, they both look pretty similar. It's for a shopping cart script, so it has to be quite secure, what thinks you?
...
I'm porting working PHP application to Java/Wicket.
I have a lot of complex, well written jQuery/javaScript which I would like to reuse and not change too much.
Obviously I have to change urls in ajax calls and rewrite the server side scripts from PHP to Java.
I tought this task would be simple but somehow I can't figure out how to write...
I am building a page which allows our members to select their notification preferences based on a number of options. For example sake, I am giving the option for the member to select notifications when a new message arrives and when an update has occured. They can receive the notification via email, sms, both, or neither.
If I simply bu...
For required/included files in PHP, is it better to use .inc extensions vs .inc.php vs .php extensions?
...
Hi,
I would like to apologize if the duplicate of this question exist. i tried to find and could find anything here that could solve my problem..
I am using a form to get the input and update it in the mysql database, and then retrieve the records in the html form, and have defined the code for deleting the records individually through ...
I'm trying to recreate the Gmail 'star' favourite button using AJAX. Unfortunately what I have isn't working and I can't work out why.
I have the following in my HMTL:
<img id="item_1" src="/_images/star_off.gif" onclick="updateStar(this.id)" />
<img id="item_2" src="/_images/star_off.gif" onclick="updateStar(this.id)" />
And I'm usi...
<hr>I want to remove this text.<embed src="stuffinhere.html"/>
I tried using regex but nothing works.
Thanks in advance.
P.S. I tried this: $str = preg_replace('#(<hr>).*?(<embed)#', '$1$2', $str)
...
I have a field (nonTimeStampDate) that has date like this
2010-03-15
and I want to check it against another field (timeStampDate) which is
2010-03-15 15:07:45
to see if the date matchs. But as you can see since the format is different it doesnt match even though the date is same.
Any help will be appreciated.
thanks
...
I'm posting from a form to a URL like so:
$.post('?class=articles&method=submit', $(this).serialize(), function(msg)
{
alert(msg);
$(msg.html).hide().insertBefore('#addCommentContainer').slideDown();
$('#body').val('');
},'json');
And in the 'submit' method the last line is:
print json_encode( array('html'=>$content) );
...
I want to have a static method in a parent class that creates instances of whatever subclass i call this method on.
An example to make this more clear:
class parent {
public static method make_objects($conditions){
for (...){
// here i want to create an instance
// of whatever subclass i am calling ...
OK, I need to scan many HTML / XHTML documents to see if a particular file has been embedded with SWFObject. If it's the case, I need to replace the call to something else.
So far I have extracted the <script> contents where the calls can be made. Now I need to scan this string to check if the call is there and if it's there I need to r...
Let's see if I can describe this properly...
I have an abstract class that when other classes extend from it, I'd like for the abstract class' data to be reset to zero.
The idea being that I have a pile of classes extending this and using MySQL table's for data structure. I don't want to query the DB with every class instantiation to d...