eburlea 23 Junior Poster

I am new in Wordpress. I have installed a plugin "Infinite Scroll". When I scroll down the page to load new articles into the page, a message appear "Loading...". I have tried to translate the message in admin panel, but that was not a translation, just a replacement of the string "Loading...". Is it possible to translate this? Please advise.

eburlea 23 Junior Poster

Does it help?

Instead:

$statement = $db->query($query);

Write:

$statement = $db->query($sql);
eburlea 23 Junior Poster

Does it help you?

<div id="parent">
    <div id="id1">1</div>
    <div id="id2">2</div>
    <div id="id3">3</div>
    <div id="id4">4</div>
    <div id="id5">5</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    var divsTotal = $('#parent div').length-1;
    var divId = $('#parent div:nth-child(' + divsTotal + ')').attr('id');
    alert(divId);
});
</script>
eburlea 23 Junior Poster
eburlea 23 Junior Poster

Finally I've got the solution.

->where("FIND_IN_SET($id, TRIM(TRAILING ']' FROM (TRIM(LEADING '[' FROM `id`))))");
  1. First I get rid of the leading '['
  2. Then I get rid of the ']' from the end of the string
  3. After that I can use FIND_IN_SET to check if my id exists there.
eburlea 23 Junior Poster

I've got it.

protected $_name = 'results';

public function getResults($resource_id_team1, $resource_id_team2)
{
    $query = $this->select()
                  ->setIntegrityCheck(false)
                  ->from(array('rt' => $this->_name))
                  ->joinLeft(array('rs1'=>'resource'),
                      'rt.resource_id_team1 = rs1.resource_id',
                      array('rs1.resource_id_team1' => 'rs1.resource_id', 'rs1.resource_name_team1' => 'rs1.resource_name'))
                  ->joinLeft(array('rs2'=>'resource'),
                      'rt.resource_id_team2 = rs2.resource_id',
                      array('rs2.resource_id_team2' => 'rs2.resource_id', 'rs2.resource_name_team2' => 'rs2.resource_name'))
                  ->where('resource_id_team1 = ?', $resource_id_team1)
                  ->where('resource_id_team2 = ?', $resource_id_team2)
                  ->where('match_result is NOT NULL');
    return $this->fetchAll($query)->toArray();
}
eburlea 23 Junior Poster

What I was looking for is this:

$email = new Zend_Form_Element_Text('email');
        $email->setLabel($sessionSettings->tr->translate('email'))
              ->setValue('')
              ->setAttribs(array('id' => 'email', 'class' => 'required email'))
              ->setRequired(true)
              ->addFilters(array('StripTags','StringTrim','StringToLower'))
              ->addValidators(array(
                  array('NotEmpty',true, array('messages' => array('isEmpty' => 'Email address field cannot be empty.'))),
                  array('EmailAddress',true, array('messages' => array('emailAddressInvalidFormat' => 'Email address name not corresponding.'))),
                  array('Db_NoRecordExists', true, array('table' => 'user', 'field' => 'email_address', 'messages' => array('recordFound' => 'Email address is taken.')))
              ));
eburlea 23 Junior Poster

@pritaeas

Thank you for fast reply. I am using version 1.X. I have tried the method setMessages and didn't work. Then I tried other method setErrorMessages and it worked.

->addValidators(array(
                  'NotEmpty',
                  'EmailAddress',
                  array('Db_NoRecordExists', true, array('user', 'email_address'))
              ))->setErrorMessages(array('Email address is taken.'));
eburlea 23 Junior Poster
$fruit = 'apple';
$$fruit = 'red';
echo $fruit . ' is ' . $apple; // returns 'apple is red'
eburlea 23 Junior Poster

Cookies and Sessions are 2 different things: http://php.about.com/od/learnphp/qt/session_cookie.htm

eburlea 23 Junior Poster

I have found another solution using a class.

class CreateFunction
{
    function __construct()
    {
        $function_name = ['myvalueone','myvaluetwo','myvaluethree','myvaluefour','myvaluefive'];

        for($i=0,$n=count($function_name); $i<$n; $i++)
        {
            $this->$function_name[$i] = create_function('', 'echo "The name of the function is ' . $function_name[$i] . '.<br />";');
        }
    }

    public function __call($method, $args)
    {
        if(property_exists($this, $method)) {
            if(is_callable($this->$method)) {
                return call_user_func_array($this->$method, $args);
            }
        }
    }
}

$object = new CreateFunction();
$function_names = ['myvalueone','myvaluetwo','myvaluethree','myvaluefour','myvaluefive'];

for($i=0,$n=count($function_names); $i<$n; $i++)
{
    $object->$function_names[$i]();
}
cereal commented: thanks for sharing! +11
eburlea 23 Junior Poster

Thank you for the answer.

Your first line provides exactly what I was looking for:

$page_content = file_get_contents($url);

Now all characters are as I need them to be.

Thanks again!

eburlea 23 Junior Poster

The main problem is that it is not possible to send values by POST method directly to another domain (it would be possible through a php file).

In case the domain would be the same, it would be necessary to add "return false;" as last statement in the submit function - as stated by pritaeas in the post above, and also ".value();" from line 13 need to change to ".val();".

eburlea 23 Junior Poster

@pritaeas
You are right. I'm using PHP Version 4.3.6. I will update it. Thank you.

eburlea 23 Junior Poster

I have turned off Windows Firewall and it is working now. Thank you all for help!

AndreRet commented: Well done on solving it. Some kudos for you +12
eburlea 23 Junior Poster

Hi all!

I am trying to insert multiple arrays values into a MySQL table. All I can manage is to echo in the browser.

I have the following arrays:

$array1 [0] = "Arsenal";
$array1 [1] = "Barcelona";
$array1 [2] = "Bayern";

$array2 [0] = "England Premier League";
$array2 [1] = "Spain Premiera Division";
$array2 [2] = "Germany Bundesliga";

What code should I write to send them to my MySQL database?

Table: teams;
Column 1: team;
Column 2: league.

For 2 days I am trying to figure it out and I give up. PLEASE HELP!!!