eug2 Posted August 24, 2013 Share Posted August 24, 2013 I copied from one page and paste to another PHP code for the expire_date to show up but it is only showing me, Expire Date: ; the code is; ";if ($evnt_cat[$ct] !="yes"){echo "<font class='smallg' >".$msg['expire_date_d'].": </font><font class='smallr' >$expire_date;</font>"; it is working well on the original page but not on the what I copied to. Please help, I appreciate your ideas very much,, eug2 Quote Link to comment https://forums.phpfreaks.com/topic/281527-copy-and-paste-the-php-for-expire_date-not-working/ Share on other sites More sharing options...
requinix Posted August 24, 2013 Share Posted August 24, 2013 You can't simply copy and paste stuff from place, put it somewhere else, and expect it to work. On that note you can't simply modify PHP code without knowing any PHP and expect that to work either. Forget the code you have now. What is the code for the rest of the file and what are you trying to change about it? Quote Link to comment https://forums.phpfreaks.com/topic/281527-copy-and-paste-the-php-for-expire_date-not-working/#findComment-1446593 Share on other sites More sharing options...
eug2 Posted August 25, 2013 Author Share Posted August 25, 2013 (edited) Hi, Guru, The file is about 6k from the almonds classifieds; t_details I hope it is ok I copy and paste it here; <?php $tmpl_tp="details"; global $layout_tmpl, $layoutnb, $rndadstmdl, $rndadsmin; include($layout_tmpl[$layoutnb]['header']); ?> <?php jqphtgal(); ?> <table width="100%" align='center' width=80 height=28 style='BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #e6e2ff 1px solid; BORDER-LEFT: #cccccc 1px solid; BORDER-BOTTOM: #ccCCcc 1px solid;'cellpadding="7" cellspacing="0" border=0 bgcolor="#ffffff"class='categbg1' > <tr><td valign='middle'> <font class='df1'> <a href='<?php echo sturl_top(); ?>'>Home:</a> <?php echo "<a href='".sturl_ct_ind($ct)."'>".$categories[$ct][0]."</a>"; ?> </font><font class='df3'> <table width="100%" align='center' width=80 height=33 style='BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #efefef 1px solid; BORDER-LEFT: #efefef 1px solid; BORDER-BOTTOM: #efefef 1px solid;'cellpadding="3" cellspacing="0" border=0 bgcolor="#f7f7f7"class='adscpt' > <tr><td valign='middle'> <font class='fnt13'> <?php echo $row['title']; ?></font> </td> </tr> </table> <font class='smallfnt'> <?php echo $view_intad; ?> </font> <?php if ($row['login']!=""){ echo " <font class='smallfnt'> ".$msg['ad_posted_member']." '".$row['login']."' </font><br>"; } ?> <?php echo lrg_photo($idnum); ?> <table width="100%" align='center' width=80 height=15 style='BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #e6e2ff 0px solid; BORDER-LEFT: #efefef 1px solid; BORDER-BOTTOM: #cccccc 1px solid;'cellpadding="13" cellspacing="0" border=0 bgcolor="#ffFFff"class='categbg1' > <tr><td valign='top'> <?php js_lrimg(); ?> <?php echo " <font class='smallg'> ".$msg['adsid'].": </font> <font class='smallr'> $idnum</font> <font class='smallg' > ".$msg['date_posted_d'].": </font> <font class='smallr' > $date_posted;</font> "; if ($evnt_cat[$ct] !="yes"){ echo " <font class='smallg' >".$msg['expire_date_d'].": </font> <font class='smallr' >$expire_date;</font> "; } echo "<font class='smallfnt'> $det_cnt </font>"; global $spamlnkfl; if($spamlnkfl=="yes"){ echo " <font class='flspm' style='color:#0000ee; TEXT-DECORATION: underline; cursor: pointer;' OnClick=\"location.href='index.php?md=flgspam&ct=$ct&id=$idnum'\";><nobr>".$msg['flag_as_spam']."</nobr></font> "; } ?> <table width="100%" align='center'height=15 style='BORDER-RIGHT: #8888ee 0px solid; BORDER-TOP: #efefef 1px solid; BORDER-LEFT: #cccccc 0px solid; BORDER-BOTTOM: #efefef 1px solid;'cellpadding="1" cellspacing="0" border=0 bgcolor="#ffFFff"class='categ' > <tr><td valign='top'> <?php foreach ( $cat_fields as $key => $value ) { if($row[$key]==""){$row[$key]='--';} if ( ($cat_fields[$key][1] == '2' or $cat_fields[$key][1] == '12') and !($key=='initialad' and $row[$key]=='--') ) { if ($row[$key]=='--'){$fld_dimd[$key]=""; $fld_dim[$key]="";} echo " <tr><td align='right' width='5%' valign='top'> <font class='fnt14'> <nobr>".$cat_fields[$key][0].":</nobr></font> </td><td> <font class='df4'> ".$fld_dimd[$key].$row[$key].$fld_dim[$key]." </td></tr> "; } } ?> </table> <p> <font class='df5'> <ul> <?php echo "<li> $contemail_info </li> $homepg_info "; ?> </ul> <?php echo print_multimed($idnum); ?> </font> <?php echo $addt_info; ?> <p> <?php if ($use_gl_map=='yes'){echo dt_map($row['addrmap'])."<p>";} ?> <p> <?php global $fb_intrfc; if($fb_intrfc=="yes") {echo fb_detp($row);} ?> <font class='df5'> <?php echo $all_ads_user; ?> </font> </td><td valign='top' width='$prphscnd'> <div id="pht1"> <?php echo print_photos($idnum, $row); ?> </div> </td> </tr></table> <?php if ($row['adcommkey']!=1){echo adsvtrform($row);} ?> <?php echo $repl_cmminf; ?> <?php if ($row['adcommkey']!=1){ echo " <table width='100%' class='dtb2' border=0 cellspacing=2 cellpadding=2> <tr><td> <font class='smallfnt'> <b> ".print_fvrt_dtl()." </b></font> </td></tr> </table> "; } ?> <br> <?php echo "<a href='index.php?ct=$ct&md=editlogin&id=$idnum' ><font class='smallfnt'> Edit Ad</font></a>"; ?> <?php if ($row['adcommkey']!=1 and $hltadsinfo!="" ){ echo " <font class='smallfnt'> $hltadsinfo </font> "; } ?> <?php global $cnt_htl_det, $hltadsf; if ($hltadsf=='yes') {$hlt_rows=get_hltads(); if (mysql_num_rows($hlt_rows)>0 and $cnt_htl_det>0){ global $cat_fields, $photos_count, $ct, $categories, $urlclscrpt, $previewphoto_url, $previewphoto_path, $prphotolimits, $pr_lim_height, $pr_lim_width, $prwph_layer, $colr_hltads, $capt_hltads, $prphscr,$prphscrwdth,$prwdly, $photo_path, $lnkttlfl, $msg, $idadcol, $colspn, $tbclhlads, $coltblayer, $check_rate, $ad_date, $ad_fields, $idnum, $ad_comment, $ad_title, $fld_dim, $fld_dimd, $check_photos, $categ_name, $lr_fields, $fields_layer, $vrwcomm; ?> <font class='smallfnt'>Highlighted ads:</font> <?php $ads_rows=$hlt_rows; include($templ['ads_list']); ?> <?php } } ?> <br> <?php js_rand_ads(750,65,0,$rndadsmin); ?> <p> <font class='smallfnt'> <a href="javascript:history.back();">Go Back</a> <a href='#' onClick='self.close()'><?php echo $msg['close_window_d'] ; ?></a> </font> </td> <?php global $fbappscrpt, $affcliframe; if ($fbappscrpt!="yes" and $affcliframe!="yes"){echo $dtl_rightcol;} ?> <?php global $layout_tmpl, $layoutnb; include($layout_tmpl[$layoutnb]['footer']); ?> Thank you a lot for solving my little problem with the PHP, eug2. Edited August 26, 2013 by Zane Quote Link to comment https://forums.phpfreaks.com/topic/281527-copy-and-paste-the-php-for-expire_date-not-working/#findComment-1446599 Share on other sites More sharing options...
eug2 Posted August 25, 2013 Author Share Posted August 25, 2013 I am sorry for the trouble here, I can not delete my post. Can it be done somehow? please. Quote Link to comment https://forums.phpfreaks.com/topic/281527-copy-and-paste-the-php-for-expire_date-not-working/#findComment-1446726 Share on other sites More sharing options...
ebk Posted August 25, 2013 Share Posted August 25, 2013 (edited) first off, that... is a scary chunk of code there. second, the variable `$evnt_cat` has not been declared before you attempt to use it and since your server has error_reporting turned off, you could not see the error it wanted to throw. the page you took that bit of PHP from (source document) was set up to allow you to use the part of code you had (the 'snippet' of code). the document you're attempting to paste that snippet into (destination document) has not been set up the same way. unfortunately, what you're trying to do is not possible without rewriting a large part if not all of the destination document. Edited August 25, 2013 by ebk Quote Link to comment https://forums.phpfreaks.com/topic/281527-copy-and-paste-the-php-for-expire_date-not-working/#findComment-1446733 Share on other sites More sharing options...
eug2 Posted August 26, 2013 Author Share Posted August 26, 2013 Hi, I copied and pasted from the same file the ID num,, for the ad, it is working ok. also, I copied the visit count and pasted , it is working ok too, precisely for every ad, I do not see a reason this expire_date would not work, I know I just missed something there,, maybe echo some wrap,, Anyways thanks a lot.. Quote Link to comment https://forums.phpfreaks.com/topic/281527-copy-and-paste-the-php-for-expire_date-not-working/#findComment-1446741 Share on other sites More sharing options...
ebk Posted August 26, 2013 Share Posted August 26, 2013 (edited) Neither of those two values being displayed depend on $evnt_cat existing prior to you using something. It is not going to work as you currently have it. Check in the source document for prior locations of $evnt_cat and note how they are used. Copy those segments over to the destination document as well. I cannot guarantee that this will work and highly doubt it will anyways. It is, however, a thing you could do if you wanted to try something. Edited August 26, 2013 by ebk Quote Link to comment https://forums.phpfreaks.com/topic/281527-copy-and-paste-the-php-for-expire_date-not-working/#findComment-1446743 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.