Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Closed Thread
Dynamic title tag question
Old 06-15-2009, 08:56 PM Dynamic title tag question
Junior Talker

Posts: 4
Name: Ricardo
Trades: 0
Hello there, here Im looking for help

I have a php Question & Answer script that currently has a static title tag.

I would like to have the title of each question to be the title tag

On my database, I have a "question" table and there is a "title" field which is what I would like to somehow call on my title tag based on the "questionid" also.

Can someone tell me how to do this

Thanks!
ricardodacosta is offline
View Public Profile
 
 
Register now for full access!
Old 06-16-2009, 02:36 AM Re: Dynamic title tag question
Extreme Talker

Posts: 181
Name: David Jackson
Trades: 0
post your code of that page

all of it
__________________

Please login or register to view this content. Registration is FREE
davidj is offline
View Public Profile
 
Old 06-16-2009, 05:39 AM Re: Dynamic title tag question
Junior Talker

Posts: 4
Name: Ricardo
Trades: 0
Quote:
Originally Posted by davidj View Post
post your code of that page

all of it
PHP Code:
<?php
    session_start
();
//    include("includes/restricted.php");



    
require_once("includes/configuration.php");
    require_once(
"includes/classes/class.database.php");
    require_once(
"includes/classes/class.category.php");
    require_once(
"includes/classes/class.question.php");
    require_once(
"includes/classes/class.langauge.php");
    require_once(
"includes/classes/class.answer.php");
    require_once(
"includes/classes/class.user.php");

    
$objCategory = new category();
    
$objQuestion = new question();
    
$objLanguage = new language();
    
$objAnswer = new answer();
    
$objUser = new user();

    
$rsLanguage $objLanguage->GetList(array(array('languageid','!=',"")),'language',true);

    if(
$_SESSION['languageid'] == '' || $_SESSION['languageid'] == 0) {
        for(
$i=0;$i<count($rsLanguage);$i++) {
            if(
$rsLanguage[$i]->language_name == "English") {
                
$language_id $rsLanguage[$i]->languageId;
            }
        }
    }
    else {
        
$language_id $_SESSION['languageid'];
    }


    if(
$HTTP_POST_VARS['btnAbuse'] == 1){
        
$objQuestion->questionId=$HTTP_POST_VARS['questionid'];
        
$objQuestion->abuse='Yes';
        
$objQuestion->Save();
    }

    if(!
$HTTP_POST_VARS['questionid']) {
        
$questionid1 $_GET['questionid'];
    }
    else {
        
$questionid1 $HTTP_POST_VARS['questionid'];
    }

    
$rsQuestion $objQuestion->GetList(array(array('questionid','=',$questionid1),array('langid','=',$language_id)),'',true);
    
$rsAnswer $objAnswer->GetList(array(array('questionid','=',$questionid1),array('langid','=',$language_id)),'',true);
    
$rsUser $objUser->GetList(array(array('userid','=',$rsQuestion[0]->userid)),'',true);

?>
<?php 
include("includes/top.php");?>
<?php 
include("includes/search.php");?>

<DIV class=home id=y-body-green-knowledge-search>
  <DIV id=content>
    <?php include("includes/left.php");?>
    <DIV id=middle>
      <DIV id=ks-homepage-heading>Question Details </DIV>
      <DIV class=silk_hp_open id=ks-homepage-questions>
        <table width="100%" cellpadding="3" cellspacing="0" border="0">
          <tr>
            <td height="13px"></td>
          </tr>
          <form name="frmQuestdetail" id="frmQuestdetail" method="post" action="questiondetail.php">
            <tr>
              <td><input type="hidden" name="questionid" id="questionid" value="<?php echo $questionid1;?>"  />
                <table width="100%" cellpadding="2" cellspacing="0" border="0">
                  <tr>
                    <td><img src="<?PHP if($rsUser[0]->photo != '') { echo "uploads/user/thumb/".$rsUser[0]->photo; } else {
                                    echo 
"http://www.webmaster-talk.com/images/man.gif"; }?>" border="0" /></td>
                    <td colspan="3" class="questiontext"><?php echo $rsQuestion[0]->title;?></td>
                  </tr>
                  <?PHP
                      $rsCategory 
$objCategory->GetList(array(array('categoryid','=',$rsQuestion[0]->categoryid),array('langid','=',$language_id)),'',true);
                  
?>
                  <tr>
                      <td colspan="4" class="questiontext"><strong>Details : </strong><?php echo $rsQuestion[0]->question_text;?></td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td width="10">&nbsp;<?php echo $rsQuestion[0]->rate;?>&nbsp;</td>
                    <td width="26"><img src="http://www.webmaster-talk.com/images/star1.gif" border="0" /></td>
                    <td>&nbsp;In <a href="categorydetail.php?catid=<?PHP echo $rsCategory[0]->categoryId;?>"><?php echo $rsCategory[0]->category_name;?></a> - Asked by <a href="userdetail.php?userid=<?PHP echo $rsUser[0]->userId;?>"><?php echo $rsUser[0]->username;?></a></td>
                  </tr>
                </table></td>
            </tr>
            <tr>
              <td><?PHP if($_SESSION['userid'] !=  $rsQuestion[0]->userid) {?><input type="submit" name="btnAnswer" value="Answer This Question" onclick="return answerques();" /> <?PHP ?>
                &nbsp;
                <input type="submit" name="btnAbuse" value="Report Abuse" />
                &nbsp;
                <input type="submit" name="btnEMail" value="E Mail To Friend" onclick="return emailfriend();" />
                &nbsp;<br /><Br />Rate This Question
                <?php
                      
for($i=1;$i<6;$i++) {
                  
?>
                <?php if($i <= $rsQuestion[0]->rate) { ?>
                <a href="#"><img id='img<?php echo $i;?>' src="http://www.webmaster-talk.com/images/starbig_r.gif" border="0" onmouseover=OnEnter('img<?php echo $i;?>') onmouseout="OnOut(<?php echo $rsQuestion[0]->rate;?>);" runat='server' onClick="return rate('<?php echo $i;?>','<?php echo $rsQuestion[0]->questionId;?>');" /></a>
                <?php
                     
}
                     else {
                     
?>
                <a href="#"><img id='img<?php echo $i;?>' src="http://www.webmaster-talk.com/images/starbig_nr.gif" border="0" onmouseover=OnEnter('img<?php echo $i;?>') onmouseout="OnOut(<?php echo $rsQuestion[0]->rate;?>);" runat='server' onClick="return rate('<?php echo $i;?>','<?php echo $rsQuestion[0]->questionId;?>');" /></a>
                <?php
                     
}
                     
?>
                <?php
                    
}
                    
?>
              </td>
            </tr>
          </form>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><table width="100%" cellpadding="5" cellspacing="0" border="0">
                <?php
                      
if(count($rsAnswer)>0){
                      for(
$i=0;$i<count($rsAnswer);$i++){
                        
$rsUser $objUser->GetList(array(array('userid','=',$rsAnswer[$i]->userid)),'',true);

                      
?>
                <tr bgcolor="#EFEFEF">
                  <td><img src="<?PHP if($rsUser[0]->photo != '') { echo "uploads/user/thumb/".$rsUser[0]->photo; } else {
                                            echo 
"http://www.webmaster-talk.com/images/man.gif"; }?>" border="0" /></td>
                  <td valign="top"><?php echo $rsAnswer[$i]->answer_text;?></td>
                </tr>
                <tr height="5px">
                    <td></td>
                </tr>
                <?php }
                        }else{
                        
?>
                <tr>
                  <td width="100%" align="center" class="tbltd">No Answer Found</td>
                </tr>


              <?php }?>
              </table>





</td>
          </tr>
        </table>
      </DIV>
      <DIV class=dotted-line></DIV>
      <!--        <P class=more-link id=ks-more-link>
        <FORM action=#><INPUT class=button type=submit value="More Open Questions >"></FORM>
        </P> -->
    </DIV>
  </DIV>
</DIV>
<?php include("includes/bottom.php");?>
<script src="js/ajax.js"></script>
<script language="javascript">

function OnEnter(cid){

    if (cid == 'img1'){

        document.getElementById('img1').src = 'images/star1.gif';
        document.getElementById('img2').src = 'images/star2.gif';
        document.getElementById('img3').src = 'images/star2.gif';
        document.getElementById('img4').src = 'images/star2.gif';
        document.getElementById('img5').src = 'images/star2.gif';


    }else if (cid == 'img2'){

        document.getElementById('img1').src = 'images/star1.gif';
        document.getElementById('img2').src = 'images/star1.gif';
        document.getElementById('img3').src = 'images/star2.gif';
        document.getElementById('img4').src = 'images/star2.gif';
        document.getElementById('img5').src = 'images/star2.gif';


    }else if (cid == 'img3'){

        document.getElementById('img1').src = 'images/star1.gif';
        document.getElementById('img2').src = 'images/star1.gif';
        document.getElementById('img3').src = 'images/star1.gif';
        document.getElementById('img4').src = 'images/star2.gif';
        document.getElementById('img5').src = 'images/star2.gif';


    }else if (cid == 'img4'){

        document.getElementById('img1').src = 'images/star1.gif';
        document.getElementById('img2').src = 'images/star1.gif';
        document.getElementById('img3').src = 'images/star1.gif';
        document.getElementById('img4').src = 'images/star1.gif';
        document.getElementById('img5').src = 'images/star2.gif';


    }else if (cid == 'img5'){

        document.getElementById('img1').src = 'images/star1.gif';
        document.getElementById('img2').src = 'images/star1.gif';
        document.getElementById('img3').src = 'images/star1.gif';
        document.getElementById('img4').src = 'images/star1.gif';
        document.getElementById('img5').src = 'images/star1.gif';

    }

}

var flag = 0;
function OnClick(cid){
    if (cid == 'img1'){
        document.getElementById('txtValue').value = '1';
        flag = 1;
    }else if (cid == 'img2'){
        document.getElementById('txtValue').value = '2';
        flag = 2;
    }else if (cid == 'img3'){
        document.getElementById('txtValue').value = '3';
        flag = 3;
    }else if (cid == 'img4'){
        document.getElementById('txtValue').value = '4';
        flag = 4;
    }else if (cid == 'img5'){
        document.getElementById('txtValue').value = '5';
        flag = 5;
    }
}

function OnOut(selected){
if (flag == 1){
            document.getElementById('img1').src = 'images/star1.gif';
            document.getElementById('img2').src = 'images/star2.gif';
            document.getElementById('img3').src = 'images/star2.gif';
            document.getElementById('img4').src = 'images/star2.gif';
            document.getElementById('img5').src = 'images/star2.gif';
}else if (flag == 2){
            document.getElementById('img1').src = 'images/star1.gif';
            document.getElementById('img2').src = 'images/star1.gif';
            document.getElementById('img3').src = 'images/star2.gif';
            document.getElementById('img4').src = 'images/star2.gif';
            document.getElementById('img5').src = 'images/star2.gif';
 }else if (flag == 3){
             document.getElementById('img1').src = 'images/star1.gif';
            document.getElementById('img2').src = 'images/star1.gif';
            document.getElementById('img3').src = 'images/star1.gif';
            document.getElementById('img4').src = 'images/star2.gif';
            document.getElementById('img5').src = 'images/star2.gif';
  }else if (flag == 4){
              document.getElementById('img1').src = 'images/star1.gif';
            document.getElementById('img2').src = 'images/star1.gif';
            document.getElementById('img3').src = 'images/star1.gif';
            document.getElementById('img4').src = 'images/star1.gif';
            document.getElementById('img5').src = 'images/star2.gif';
    }else if (flag == 5){
            document.getElementById('img1').src = 'images/star1.gif';
            document.getElementById('img2').src = 'images/star1.gif';
            document.getElementById('img3').src = 'images/star1.gif';
            document.getElementById('img4').src = 'images/star1.gif';
            document.getElementById('img5').src = 'images/star1.gif';
    }else if (flag == 0){
            document.getElementById('img1').src = 'images/star2.gif';
            document.getElementById('img2').src = 'images/star2.gif';
            document.getElementById('img3').src = 'images/star2.gif';
            document.getElementById('img4').src = 'images/star2.gif';
            document.getElementById('img5').src = 'images/star2.gif';

    }
    for(i=1;i<6;i++) {
        if(i<=selected) {
            document.getElementById('img'+i).src = 'images/star1.gif';
        }
    }
}

function rate(val,imageid)
{
    InsertCustomer('eval.php?rate_val='+val+'&imageid='+imageid);
}
    function rateaction(act,val) {
        result = true;
        document.frm.act.value = act;
        document.frm.albumid.value = val;
        if(act == 'searchchar') {
            document.frm.matchchar.value = val;
        }
        if(act == 'delete') {
            result = confirm("Are you sure you want to delete genre?");
        }
        if(!result) {
            return false;
        }
        document.frm.submit();
    }
</script>
<script language="javascript">
function answerques(){
    document.frmQuestdetail.action='answerthisquestion.php';
    document.frmQuestdetail.submit();
}
function emailfriend(){
    document.frmQuestdetail.action='emailtofriend.php';
    document.frmQuestdetail.submit();
}
function reportabuse() {
    document.frmQuestdetail.btnAbuse.value = 1;
    document.frmQuestdetail.submit();
}
</script>

Last edited by chrishirst; 11-18-2009 at 12:04 PM..
ricardodacosta is offline
View Public Profile
 
Old 06-16-2009, 05:53 AM Re: Dynamic title tag question
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
Well, i don't see a <title> tag in the code above which means the head of your page is somewhere else. If you want a quick fix you can go through the JavaScript.

Simply do this:

document.title = '<?=$title_you_want_here?>';
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
View Public Profile Visit microcolt's homepage!
 
Old 06-16-2009, 06:15 AM Re: Dynamic title tag question
Junior Talker

Posts: 4
Name: Ricardo
Trades: 0
The title is currently being called from file top.php:

<title><? echo $configuration['title'] ?></title>

I dont want an static title, I need the title of each question to be the title of the the page above (the one I posted the full code)

I thiknk I need to fetch it from my question table on my database, but I don't know how.

Please help
ricardodacosta is offline
View Public Profile
 
Old 06-16-2009, 06:40 AM Re: Dynamic title tag question
maxxximus's Avatar
Extreme Talker

Posts: 219
Name: Rob
Location: UK
Trades: 0
Not being able to see your classes but I would guess. This needs to go in the <head> section (in the top.php file)

PHP Code:
<head>
<title><?php echo $rsQuestion[0]->question_text;?></title></head>

Last edited by maxxximus; 06-16-2009 at 06:42 AM..
maxxximus is offline
View Public Profile
 
Old 06-16-2009, 06:47 AM Re: Dynamic title tag question
Junior Talker

Posts: 4
Name: Ricardo
Trades: 0
Tried that, but didn't work

Here is the file class/question:

PHP Code:
<?php
/*
    This SQL query will create the table to store your object.

    CREATE TABLE `question` (
    `questionid` int(11) NOT NULL auto_increment,
    `langid` int(1) NOT NULL,
    `question_text` text NOT NULL,
    `userid` int(10) NOT NULL,
    `categoryid` int(5) NOT NULL,
    `title` varchar(50) NULL,
    `date1` bigint(15) NOT NULL,
    `status` enum('Active','Inactive') NOT NULL,
    `abuse` enum('Yes','No') NOT NULL,
    `rate` int(1) NOT NULL, PRIMARY KEY  (`questionid`));
*/

/**
* <b>question</b> class with integd CRUD methods.
* @author Php Object Generator
* @version POG 2.6.3 / PHP4
* @copyright Free for personal & commercial use. (Offered under the BSD license)
* @link [url]http://www.phpobjectgenerator.com/?language=php4&wrapper=pog&objectName=question&attributeList=array+%28%0A++0+%3D%3E+%27langid%27%2C%0A++1+%3D%3E+%27question_text%27%2C%0A++2+%3D%3E+%27userid%27%2C%0A++3+%3D%3E+%27categoryid%27%2C%0A++4+%3D%3E+%27date1%27%2C%0A++5+%3D%3E+%27status%27%2C%0A++6+%3D%3E+%27abuse%27%2C%0A++7+%3D%3E+%27rate%27%2C%0A%29&typeList=array+%28%0A++0+%3D%3E+%27int%281%29%27%2C%0A++1+%3D%3E+%27text%27%2C%0A++2+%3D%3E+%27int%2810%29%27%2C%0A++3+%3D%3E+%27int%285%29%27%2C%0A++4+%3D%3E+%27bigint%2815%29%27%2C%0A++5+%3D%3E+%27enum%28%5C%5C%5C%27Active%5C%5C%5C%27%2C%5C%5C%5C%27Inactive%5C%5C%5C%27%29%27%2C%0A++6+%3D%3E+%27enum%28%5C%5C%5C%27Yes%5C%5C%5C%27%2C%5C%5C%5C%27No%5C%5C%5C%27%29%27%2C%0A++7+%3D%3E+%27varchar%2815%29%27%2C%0A%29[/url]
*/
class question
{
    var 
$questionId '';

    
/**
     * @var int(1)
     */
    
var $langid;
    
    
/**
     * @var text
     */
    
var $question_text;
    
    
/**
     * @var int(10)
     */
    
var $userid;
    
    
/**
     * @var int(5)
     */
    
var $categoryid;
    
    
/**
     * @var varchar(50)
     */    
    
var $title;
    
/**
     * @var bigint(15)
     */
    
var $date1;
    
    
/**
     * @var enum('Active','Inactive')
     */
    
var $status;
    
    
/**
     * @var enum('Yes','No')
     */
    
var $abuse;
    
    
/**
     * @var varchar(15)
     */
    
var $rate;
    
    var 
$pog_attribute_type = array(
        
"questionId" => array("NUMERIC""INT"),
        
"langid" => array("NUMERIC""INT""1"),
        
"question_text" => array("TEXT""TEXT"),
        
"userid" => array("NUMERIC""INT""10"),
        
"categoryid" => array("NUMERIC""INT""5"),
        
"title" => array("TEXT""VARCHAR""50"),
        
"date1" => array("NUMERIC""BIGINT""15"),
        
"status" => array("SET""ENUM""'Active','Inactive'"),
        
"abuse" => array("SET""ENUM""'Yes','No'"),
        
"rate" => array("NUMERIC""INT""1"),
        );
    var 
$pog_query;
    
    function 
question($langid=''$question_text=''$userid=''$categoryid='',$title=''$date1=''$status=''$abuse=''$rate='')
    {
        
$this->langid $langid;
        
$this->question_text $question_text;
        
$this->userid $userid;
        
$this->categoryid $categoryid;
        
$this->title $title;
        
$this->date1 $date1;
        
$this->status $status;
        
$this->abuse $abuse;
        
$this->rate $rate;
    }
    
    
    
/**
    * Gets object from database
    * @param integer $questionId 
    * @return object $question
    */
    
function Get($questionId)
    {
        
$Database = new DatabaseConnection();
        
$this->pog_query "select * from `question` where `questionid`='".intval($questionId)."' LIMIT 1";
        
$Database->Query($this->pog_query);
        
$this->questionId $Database->Result(0"questionid");
        
$this->langid = ($Database->Result(0"langid"));
        
$this->question_text = ($Database->Result(0"question_text"));
        
$this->userid = ($Database->Result(0"userid"));
        
$this->categoryid = ($Database->Result(0"categoryid"));
        
$this->title = ($Database->Result(0"title"));
        
$this->date1 = ($Database->Result(0"date1"));
        
$this->status $Database->Result(0"status");
        
$this->abuse $Database->Result(0"abuse");
        
$this->rate = ($Database->Result(0"rate"));
        return 
$this;
    }
    
    
    
/**
    * Returns a sorted array of objects that match given conditions
    * @param multidimensional array {("field", "comparator", "value"), ("field", "comparator", "value"), ...} 
    * @param string $sortBy 
    * @param boolean $ascending 
    * @param int limit 
    * @return array $questionList
    */
    
function GetList($fcv_array$sortBy=''$ascending=true$limit='')

    {
        
$sqlLimit = ($limit != '' && $sortBy == ''?"LIMIT $limit":'');
        if (
sizeof($fcv_array) > 0)
        {
            
$questionList = Array();
            
$Database = new DatabaseConnection();
            
$this->pog_query "select questionid from `question` where ";
            for (
$i=0$c=sizeof($fcv_array); $i<$c$i++)
            {
                if (
sizeof($fcv_array[$i]) == 1)
                {
                    
$this->pog_query .= " ".$fcv_array[$i][0]." ";
                    continue;
                }
                else
                {
                    if (
$i && sizeof($fcv_array[$i-1]) != 1)
                    {
                        
$this->pog_query .= " AND ";
                    }
                    if (isset(
$this->pog_attribute_type[$fcv_array[$i][0]]) && $this->pog_attribute_type[$fcv_array[$i][0]][0] != 'NUMERIC' && $this->pog_attribute_type[$fcv_array[$i][0]][0] != 'SET')
                    {
                        
$this->pog_query .= "`".strtolower($fcv_array[$i][0])."` ".$fcv_array[$i][1]." '".($fcv_array[$i][2])."'";
                    }
                    else
                    {
                        
$this->pog_query .= "`".strtolower($fcv_array[$i][0])."` ".$fcv_array[$i][1]." '".$fcv_array[$i][2]."'";
                    }
                }
            }
            
$this->pog_query .= " order by questionid DESC $sqlLimit";

            
$Database->Query($this->pog_query);
            
$thisObjectName get_class($this);
            for (
$i=0$i $Database->Rows(); $i++)
            {
                
$question = new $thisObjectName();
                
$question->Get($Database->Result($i"questionid"));
                
$questionList[] = $question;
            }

            if (
$sortBy != '')
            {
                
$f '';
                
$question = new question();
                if (isset(
$question->pog_attribute_type[$sortBy]) && ($question->pog_attribute_type[$sortBy][0] == "NUMERIC" || $question->pog_attribute_type[$sortBy][0] == "SET"))
                {
                    
$f 'return $question1->'.$sortBy.' > $question2->'.$sortBy.';';
                }
                else if (isset(
$question->pog_attribute_type[$sortBy]))
                {
                    
$f 'return strcmp(strtolower($question1->'.$sortBy.'), strtolower($question2->'.$sortBy.'));';
                }
                
usort($questionListcreate_function('$question1, $question2'$f));
                if (!
$ascending)
                {
                    
$questionList array_reverse($questionList);
                }
                if (
$limit != '')
                {
                    
$limitParts explode(','$limit);
                    if (
sizeof($limitParts) > 1)
                    {
                        return 
array_slice($questionList$limitParts[0], $limitParts[1]);
                    }
                    else
                    {
                        return 
array_slice($questionList0$limit);
                    }
                }
            }
            return 
$questionList;
        }
        return 
null;
    }
    
    
    
/**
    * Saves the object to the database
    * @return integer $questionId
    */
    
function Save()
    {
        
$Database = new DatabaseConnection();
        
$this->pog_query "select `questionid` from `question` where `questionid`='".$this->questionId."' LIMIT 1";
        
$Database->Query($this->pog_query);
        if(
$this->question_text==''){
        
$this->pog_query "update `question` set 
            `abuse`='"
.$this->abuse."'
             where `questionid`='"
.$this->questionId."'";
        }
        else if (
$Database->Rows() > 0)
        {
            
$this->pog_query "update `question` set 
            `langid`='"
.($this->langid)."', 
            `question_text`='"
.($this->question_text)."', 
            `userid`='"
.($this->userid)."', 
            `categoryid`='"
.($this->categoryid)."', 
            `title`='"
.($this->title)."', 
            `date1`='"
.($this->date1)."', 
            `status`='"
.$this->status."', 
            `abuse`='"
.$this->abuse."', 
            `rate`='"
.($this->rate)."' where `questionid`='".$this->questionId."'";
        }
        else
        {
            
$this->pog_query "insert into `question` (`langid`, `question_text`, `userid`, `categoryid`,`title` ,`date1`, `status`, `abuse`, `rate` ) values (
            '"
.($this->langid)."', 
            '"
.($this->question_text)."', 
            '"
.($this->userid)."', 
            '"
.($this->categoryid)."', 
            '"
.($this->title)."', 
            '"
.($this->date1)."', 
            '"
.$this->status."', 
            '"
.$this->abuse."', 
            '"
.($this->rate)."' )";
        }
        
$Database->InsertOrUpdate($this->pog_query);
        if (
$this->questionId == "")
        {
            
$this->questionId $Database->GetCurrentId();
        }
        return 
$this->questionId;
    }
    
    
    
/**
    * Clones the object and saves it to the database
    * @return integer $questionId
    */
    
function SaveNew()
    {
        
$this->questionId '';
        return 
$this->Save();
    }
    
    
    
/**
    * Deletes the object from the database
    * @return boolean
    */
    
function Delete()
    {
        
$Database = new DatabaseConnection();
        
$this->pog_query "delete from `question` where `questionid`='".$this->questionId."'";

        return 
$Database->Query($this->pog_query);
    }
    
    
    
/**
    * Deletes a list of objects that match given conditions
    * @param multidimensional array {("field", "comparator", "value"), ("field", "comparator", "value"), ...} 
    * @param bool $deep 
    * @return 
    */
    
function DeleteList($fcv_array)
    {
        if (
sizeof($fcv_array) > 0)
        {
            
$Database = new DatabaseConnection();
            
$pog_query "delete from `question` where ";
            for (
$i=0$c=sizeof($fcv_array); $i<$c$i++)
            {
                if (
sizeof($fcv_array[$i]) == 1)
                {
                    
$pog_query .= " ".$fcv_array[$i][0]." ";
                    continue;
                }
                else
                {
                    if (
$i && sizeof($fcv_array[$i-1]) !== 1)
                    {
                        
$pog_query .= " AND ";
                    }
                    if (isset(
$this->pog_attribute_type[$fcv_array[$i][0]]) && $this->pog_attribute_type[$fcv_array[$i][0]][0] != 'NUMERIC' && $this->pog_attribute_type[$fcv_array[$i][0]][0] != 'SET')
                    {
                        
$pog_query .= "`".$fcv_array[$i][0]."` ".$fcv_array[$i][1]." '".($fcv_array[$i][2])."'";
                    }
                    else
                    {
                        
$pog_query .= "`".$fcv_array[$i][0]."` ".$fcv_array[$i][1]." '".$fcv_array[$i][2]."'";
                    }
                }
            }
            return 
$Database->Query($pog_query);
        }
    }
}
?>

Last edited by chrishirst; 11-18-2009 at 12:03 PM..
ricardodacosta is offline
View Public Profile
 
Old 11-18-2009, 11:41 AM Re: Dynamic title tag question
kcmartz's Avatar
Super Talker

Latest Blog Post:
~Gri to Kcmartz~
Posts: 120
Name: Kenson
Location: Washington, USA
Trades: 0
I want to do this exact thing! ("Following"!)
__________________
Thanks,

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
for problems/site.
kcmartz is offline
View Public Profile Visit kcmartz's homepage!
 
Closed Thread     « Reply to Dynamic title tag question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.67730 seconds with 12 queries