Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
612 views
in Q2A Core by
edited by

in some functions in theme-base output text is already generated, such as:

        function post_meta_when($post, $class)
        {
            $this->output_split(@$post['when'], $class.'-when');
        }

value of $post['when'] is like :

<SPAN CLASS="published"><SPAN CLASS="value-title" TITLE="2012-10-07T21:31:48+0000"></SPAN>3 days</SPAN>

so, how can I get direct access to information inside span tag?

Where this output is generated? can it be replaced with another function for some case?

 

1 Answer

+1 vote
by
selected by
 
Best answer

There is a big array called $post['raw'] which contains the raw information from the database.

by
$post['raw'] contains useful information about post, but I could not find meta information such as when it was posted, etc.
however in $post itself this information exist in this form:
'when' =>
    array
      'prefix' => string '' (length=0)
      'data' => string '<SPAN CLASS="published"><SPAN CLASS="value-title" TITLE="2012-10-07T21:31:48+0000"></SPAN>3 days</SPAN>' (length=103)
      'suffix' => string ' ago' (length=4)

how can I directly access this pure data without SPAN tag or other tags?
by
It's all there in $post['raw'] - there are a lot of fields. You should find the created time in $post['raw']['created'] as a unix timestamp.
by
Thanks, it worked. and I ask it out of curiosity, if $post is generated from $post['raw'] inside which class or file it is created?
by
Mostly qa_post_html_fields() in qa-app-format.php
...