• 20-07-2013, 19:35:42
    #1
    Merhabalar,

    Elimde hazır, düzenlemiş olduğum bir php dosyam var. İçerisinde html kodlarıda var gördüğünüz gibi. Bu php dosyasının tek başına yaptığı işi html + php ile yapmak istiyorum. Yani içindeki html kodlarını php dosyasından alarak sitenin başka yerine ekleyeceğim. Ama bu iki kod birbiri ile birleşik çalışacak. Umarım ne demek istediği anlamışsınızdır. Kodlarla aram maalesef pek iyi değil

    <?php
    // ####################### SET PHP ENVIRONMENT ###########################
    error_reporting(E_ALL & ~E_NOTICE);
    
    // #################### DEFINE IMPORTANT CONSTANTS #######################
    define('NO_REGISTER_GLOBALS', 1);
    define('THIS_SCRIPT', 'tab_news'); // change this depending on your filename
    
    // ################### PRE-CACHE TEMPLATES AND DATA ######################
    // get special phrase groups
    $phrasegroups = array('calendar', 'adv_portal', 'postbit');
    
    // get special data templates from the datastore
    $specialtemplates = array('smiliecache', 'bbcodecache',);
    
    // pre-cache templates used by all actions
    $globaltemplates = array('adv_portal_newsbits');
    
    // pre-cache templates used by specific actions
    $actiontemplates = array();
    
    // ######################### REQUIRE BACK-END ############################
    require_once('./global.php');
    require_once('./includes/class_bbcode.php');
    require_once('./includes/functions_user.php');
    
    // #######################################################################
    // ######################## START MAIN SCRIPT ############################
    // #######################################################################
    
    $bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
    
    $mod_options['news_cutoffdate'] = 365;  //Cut of date of how many days to search back for news
    $mod_options['news_threads_forumid'] = '172,173,174,175,180,176,189,187,188,198,195,196,197,206,207,208,209,210,200,201';	 // Add the forumid(s) you would like to display threads from in your news module. Seperate each with a comma.
    $mod_options['charlimit'] =	80;  // Character limit for display purposes.  will display ...MORE link after this limit.. 
    $newslimit	=	20; // the number of news items to display
    $titlelen	=	160; // Title Lenght cutoff 
    
    $forumids = array($mod_options['news_threads_forumid']);
    
    $getnews = $db->query_read(" 
    	SELECT t.threadid, t.title, t.lastpost, t.forumid, t.open, t.replycount, t.postusername, t.postuserid, t.lastposter, t.dateline, t.views, t.visible, t.firstpostid, f.title AS forumtitle, post.pagetext AS preview 
    	FROM " . TABLE_PREFIX . "forum f 
    	INNER JOIN " . TABLE_PREFIX . "thread t ON t.forumid = f.forumid
    	LEFT OUTER JOIN " . TABLE_PREFIX . "post AS post ON post.postid = t.firstpostid 
    	WHERE t.forumid IN(" . implode(',', $forumids) . ")
    	" . iif($mod_options['news_cutoffdate'], 'AND t.dateline > ' . (TIMENOW - ($mod_options['news_cutoffdate'] * 86400))) . "
    	ORDER BY dateline DESC 
    	LIMIT " . $newslimit . " 
    ");
    
    
    	while($news = $db->fetch_array($getnews))
    	{
    
    	
    		$news['title']			=	preg_replace('/\<[a-zA-Z0-9 \-_şıüğçİŞĞÜÇ\&lt;\<\>\&gt;\:\;\"\'\,\.\?\/\~\`\!\@\#\$\%\^\&\*\(\)\_\-\+\=]*\>/', '', $news['title']);
    		$news['title']			=	fetch_trimmed_title(fetch_censored_text(unhtmlspecialchars($news['title'])), $titlelen);
    		$news['forumtitle']		=	stripslashes($news['forumtitle']);
    		$news['date']			=	vbdate($vbulletin->options['dateformat'], $news['dateline']);
    		$news['time']			=	vbdate($vbulletin->options['timeformat'], $news['dateline']);
    		$news['replycount']		=	vb_number_format($news['replycount']);
    		$news['views']			=	vb_number_format($news['views']);
    		$news['postusername']	=	$news['postusername'];
    		$news['lastposter']		=	$news['lastposter'];
    		$news['preview']		=	preg_replace('/\<[a-zA-Z0-9 \&lt;\<\>\&gt;\:\;\"\'\,\.\?\/\~\`\!\@\#\$\%\^\&\*\(\)\_\-\+\=]*\>/', '', $news['preview']);
    		$news['pagetext'] 		=	$bbcode_parser->do_parse($news['preview'], 1, 1, 1, 1);
    		$news['charcheck']		= 	strlen($news['pagetext']);
    		$news['pagetext']		=	substr($news['pagetext'], 0, $mod_options['charlimit']);
    		$endoftext				=	'<span class="smallfont"><br /><br /><a href="showthread.php?t='. $news['threadid'] .'" ><img src="images/UploadResimleri/konunundevami.gif" /></strong></a></span>';
     
     
    		echo '<div style="padding:0px 0px 10px 0px; margin-top:-1px">';
    		echo '<table class="tborder" cellspacing="1" cellpadding="6" border="0"  width="100%">';
    		echo '<tr>';
    		echo '<td class="tcat smallfont"><a href="showthread.php?t=' . $news[threadid] . '" title="' . $news[title] . '"><strong>' . $news[title] . '</strong></a></td>';
    		echo '</tr>';
    				
    		echo '<tr>';
    		echo '<td class="thead">' . $news[date] . ' - ' . $news[time] . ' - yazan <a href="member.php?u=' . $news[postuserid] . '" title="' . $news[postusername] . '">' . $news[postusername] . '</a></td>';
    		echo '</tr>';
    
    		if ($mod_options['charlimit'] AND $news['charcheck'] > $mod_options['charlimit'])
    		{		
    			echo '<tr>';
    			echo '<td class="alt1" valign="top" align="center">' . $news[pagetext] . $endoftext . '</td>';
    			echo '</tr>';
    		}
    		else
    		{		
    			echo '<tr>';
    			echo '<td class="alt1" valign="top" align="center">' . $news[pagetext] . '</td>';
    			echo '</tr>';
    		}		
    		echo '<tr class="alt2" valign="middle">';
    		
    		
    		
    		echo '<td valign="middle"><span style="float: right;"><a href="http://twitter.com/home?status=' . $news[title] . ': http://www.siteadi.com/showthread.php?t=' . $news[threadid] . '" target="_blank"><img src="/styles/siteaditema/misc/twitpaylas.png" border="0" height="26px" alt="Konuyu twitterda paylaş" target="_blank" /></a>&nbsp&nbsp<a href="http://www.facebook.com/share.php?u=http://www.siteadi.com/showthread.php?t=' . $news[threadid] . '" target=new><img src="/styles/siteaditema/misc/facepaylas.png" border="0" height="26px" alt="Konuyu facebookta paylaş" /></a></span> <div style="margin-top:5px"><span class="smallfont">' . $news[replycount] . ' Cevap | ' .  $news[views] . ' Görüntülenme</span></div></td>';
    		echo '</tr>';
    		echo '</table>';
    		echo '</div>';
    	
    	
    	
    	
    		}
    ?>
  • 20-07-2013, 19:43:03
    #2
    Bu şekilde çalışacaksanız, yine bazı kısımlarda iç içe olması gereken bölümler olur örn:
                echo '<td class="alt1" valign="top" align="center">' . $news[pagetext] . '</td>';
    ama sadece php kısımları için hepsini bir .php dosyasına eklersiniz ana dosyanın uzantısı yine php olur ve include diyerek çağırırsınız örn:
    <?php
    include("connect.php");
    go..
    ?>
  • 20-07-2013, 20:41:41
    #3
    LORDD, tam olarak yapmak istediğim şöyle; yukarıdaki php dosyasının içindeki html kodları kesip başka bir yere yapıştırmak. Ve html kodları yukarıdaki php dosyasındaki veriler (değişkenler) ile çalıştırmak.
  • 20-07-2013, 22:23:03
    #4
    html içine php göm daha kolay olur. Dosya uzantısı .php olsun ama.

    Örnek:

    <html>
    <head>
    </head>
    <body>
    <?php fonks1(); ?>

    <div class="wrapper">
    <?php fonks2(); ?> </br> <?php echo $degisken; ?>
    </div>
    </body>
    </html>
  • 21-07-2013, 17:35:59
    #5
    Benim anlatmak istediğim tam olarak bu değildi Yine de yardımlarınız için teşekkürler.
  • 25-07-2013, 18:20:07
    #6
    mirach61 adlı üyeden alıntı: mesajı görüntüle
    Benim anlatmak istediğim tam olarak bu değildi Yine de yardımlarınız için teşekkürler.
    Yanılmıyorsam yapmak istediğiniz, bir sciprt 'e özel tema yapmak. Bunu örneklendirmek gerekirse prestashop ücretsiz e-ticaret sistemini ele alabiliriz, php class vs. farklı yerlerde barınmakta ve .tpl uzantısında html vb içerikli tema dosyaları var ancak burada bile bir değişken var illa ki bir yerde birlikte kullanmanız gerekir az ya da çok.
    Eğer yine sizi yanlış anlamışsam lütfen örnek vererek ve daha detaylı olarak iletiniz.

    Kolay gelsin.