Jump to content

beginer date help


simun

Recommended Posts

here is whole page code

<?php
include('templates/' . $__config['template'] . '/header.php');?>
 <div id="headerpocetna" style="width: 960px; height: 200px; margin-top:-235px;"></div>
<? include('templates/' . $__config['template'] . '/menu2.php');	




$object->gallery->getPhotos();



?>


<div id="content">

	<h1 style="padding-bottom:10px;">
        
        <a style="text-decoration:none; color:#237DB7;" href=" "><?=$__current['naslov'][$__language]?></a> - <?=$object->{'naziv_' . $__language}?>
        
        </h1>
       







        
        
        
        
	<div class="clear"></div>
        

<div style="float:left; width:350px; border-right:solid 1px #cccccc; margin-right:5px;" >

    
	 <p style=" padding-bottom:5px; font-size:11px;">Datum: 



	 <?php

$timee=date('d.m.Y',strtotime($object->{'datum'}));
echo $timee;
?>

	</p>
                                               
                                                           
</div>
<div style="float:left; width:360px; padding-left:10px:" >

	<p style=" padding-bottom:5px; font-size:11px;"><?=$object->{'opis_' . $__language}?></p>
          
                                               
                                                           
</div>

            <div class="clear"></div>

            
            
            <h2><?php echo $__l['galerija'] ?></h2>

		<div class="images-details" >
<?php
if (is_array($object->gallery->photos)) {
	foreach($object->gallery->photos as $photo) {


	$myFile = "files/naslovi/hr/" . $object->id . "/" . $photo['filename'] . ".txt";
	$fh = fopen($myFile, 'r');
	$theData = fgets($fh);
	fclose($fh);

	$myFileen = "files/naslovi/en/" . $object->id . "/" . $photo['filename'] . ".txt";
	$fhen = fopen($myFileen, 'r');
	$theDataen = fgets($fhen);
	fclose($fhen);


?>
			<a class="thickbox" title="<? if ($__language == hr){echo $theData;} else {echo $theDataen;}?>" href="/images/cache/objects/<?=$object->id?>/<?=$photo['filename']?>/w-800.jpg" rel="galler"><?

				?><img alt=""  src="/images/cache/objects/<?=$object->id?>/<?=$photo['filename']?>/h-98.jpg" /><?
			?></a>

<?php
	}
}
?>
			</div>
		</div>
          
        

<?php
include('templates/' . $__config['template'] . '/footer.php');
?>

Link to comment
https://forums.phpfreaks.com/topic/166218-beginer-date-help/#findComment-876565
Share on other sites

here is my page with query

 

and kategorizacija is table where date is stored

 

<?php

$sql = 'SELECT * FROM objects WHERE zupanija > ""';

$box=$_POST['box'];
while (list ($key,$val) = @each ($box)) {

$sql .=  '' . $val . '';}
$sql .= ' ORDER BY kategorizacija DESC';



if (isset($__current['database']['per_page'])) {
	$result_total = mysql_query($sql);
	if ($result_total) {
		$total_objects = mysql_num_rows($result_total);
		mysql_free_result($result_total);
	}

	$total_pages = ceil((int)$total_objects / (int)$__current['database']['per_page']);
	if (isset($_GET['l'])) {
		$limit = $_GET['l'];
	}
	$sql .= ' LIMIT ' . (int)$limit . ', ' . (int)$__current['database']['per_page'];
}

if ((int)$__query[3] > 0) {
	$object = new S_Object;
	if ($object->load((int)$__query[3])) {
		$__current['title'][$__language] = $object->{'naziv_' . $__language} . ' - ' . $__current['title'][$__language];
		include('object_galerija.details.php');
	}
} else {

$query = mysql_query($sql);

include('templates/' . $__config['template'] . '/header.php');?>
     <div id="headerpocetna" style="width: 960px; height: 200px; margin-top:-235px;"></div>
     <?
include('templates/' . $__config['template'] . '/menu2.php');

?>


<div id="content">
    <div style="float:left">
	<h1><?=$__current["title"][$__language]?></h1>
	</div>
      <div class="clear"></div>
       <div style="float:left; padding-top:10px; width:305; padding-right:10px; margin-right:10px; border-right:solid 1px #cccccc;">
       
<div style="width:305px; font-size:11px; color: #666666; padding-bottom:15px;">Poštovani korisnici, radi lakšeg pregleda, vizualizacije su podjeljene u kategorije. Odabirom željene kategorije prikazati će se samo radovi iz iste.</div>
       
<form action="../">
<select style=" border:solid 1px #cccccc; background-color:#FFFFFF; font-size:12px; color:#666666; padding:2px;" onchange="window.open(this.options[this.selectedIndex].value,'_top')">
<option value="<?php echo '/' . $__language . '/galerija'?>">Sve vizualizacije</option>
<option value="<?php echo '/' . $__language . '/galerija_obi'?>">Arh. vizualizacije obiteljskih/stambenih objekata </option>
<option value="<?php echo '/' . $__language . '/galerija_pos'?>">Arh. vizualizacije vi&#353;estambenih objekata </option>
<option value="<?php echo '/' . $__language . '/galerija_sak'?>">Arh. vizualizacije javnih/poslovnih objekata </option>
<option value="<?php echo '/' . $__language . '/galerija_sta'?>">Arh. vizualizacije urb-arh studija</option>
<option value="<?php echo '/' . $__language . '/galerija_stu'?>">Tehni&#269;ke vizualizacije</option>
<option value="<?php echo '/' . $__language . '/galerija_vis'?>">Ostale vizualizacije</option>

</select>
</form>

</div>

<div style=" float:left; padding-top:10px; width:350; font-size:11px;">
        <div style="width:350px; font-size:11px; color: #666666; padding-bottom:5px;">Primjena samih vizualizacija vrlo je široka, pa smo radi lakšeg pregleda dodali još nekoliko opcija za filtriranje projekata ovisno o njihovom sadržaju.</div>
<p>



<?


echo "<form method=post action=''>";

echo "

   <div style='font-size:11px; color: #666666; float:left; width:130px; padding-top:3px; padding-bottom:3px;'><input type=checkbox name=box[] value='AND eksterijer = 1 '>Eksterijer</div>
<div style='font-size:11px; color: #666666; float:left; width:160px; padding-top:3px; padding-bottom:3px;'><input type=checkbox name=box[] value='AND interijer = 1 '>Interijer</div>
  <div style='font-size:11px; color: #666666; float:left; width:100px; padding-top:3px; padding-bottom:3px;'><input type=checkbox name=box[] value='AND presjeci3d = 1 '>3D presjeci</div>
   <div class='clear'></div>
   <div style='font-size:11px; color: #666666; float:left; width:130px; padding-top:3px; padding-bottom:3px;'><input type=checkbox name=box[] value='AND fotomontaze = 1 '>Fotomonta&#382;e</div>
<div style='font-size:11px; color: #666666; float:left; width:160px; padding-top:3px; padding-bottom:3px;'><input type=checkbox name=box[] value='AND animacija = 1 '>Animacija/Prezentacija</div>
  <div style='font-size:11px; color: #666666; float:left; width:100px; padding-top:3px; padding-bottom:3px;'><input type=checkbox name=box[] value='AND katalogs = 1 '>Katalozi</div>
  <div class='clear'></div>
  <div style='font-size:11px; color: #666666; 'float:left; width:130px; padding-top:3px; padding-bottom:3px;'><input type=checkbox name=box[] value='AND tablag = 1 '>Reklamne table</div>
  <div align='right' style='float:right; width:40px; padding-top:3px; padding-bottom:3px; margin-top:-20px;'><input style=' border:solid 1px #cccccc; background-color:#FFFFFF; font-size:12px; color:#666666; padding:2px;' type=submit value=Filtriraj></div>

"; ?>



</p>

  </div>
      
      
      
      
      
<?php
echo '<!--' . $sql . '-->';
//************************************************************************
// PAGER
//************************************************************************
if ($total_pages > 1) {		
?>
	<div class="pager">
<?php
	$page_next = $limit + $__current['database']['per_page'];
	$page_next_limit_string = '/?l=' . $page_next;
	$page_prev = $limit - $__current['database']['per_page'];
	$page_prev_limit_string = '/?l=' . $page_prev;
	if ((int)$page_prev == 0) {
		$page_prev_limit_string = '';
	}
	if ($page_prev > -1) {
?>
	<a href="<?php echo '/' . $__language . '/' . $__current['link'][$__language] . $page_prev_limit_string ?>" class="arrow"><<</a> 
<?php
	}

	for ($p = 1; $p <= $total_pages; $p++) {

		$page_limit = ($p-1)*$__current['database']['per_page'];
		$page_limit_string = '/?l=' . (int)$page_limit;
		if ($page_limit == 0) { 
			$page_limit_string = '';
		}
?>
		<a<?php 

	if ($limit == $page_limit) echo ' class="selected"';

	?> href="<?php echo '/' . $__language . '/' . $__current['link'][$__language] . $page_limit_string ?>"><?=$p?></a>

<?php
	}

	if ($page_next < $total_objects) {
?>
	<a href="<?php echo '/' . $__language . '/' . $__current['link'][$__language] . $page_next_limit_string ?>" class="arrow">>></a>
<?php
	}
?>
	</div>
	<div class="clear"></div>
<?php
}
//************************************************************************
if ($query) {
	$counter = 0;
	while ($o = mysql_fetch_assoc($query)) {
		include('object_galerija.small.php');
		$counter++;
	}
}
//************************************************************************
// PAGER
//************************************************************************
if ($total_pages > 1) {		
?>
	<div class="clear"></div>
	<div class="pager">
<?php
	$page_next = $limit + $__current['database']['per_page'];
	$page_next_limit_string = '/?l=' . $page_next;
	$page_prev = $limit - $__current['database']['per_page'];
	$page_prev_limit_string = '/?l=' . $page_prev;
	if ((int)$page_prev == 0) {
		$page_prev_limit_string = '';
	}
	if ($page_prev > -1) {
?>
	<a href="<?php echo '/' . $__language . '/' . $__current['link'][$__language] . $page_prev_limit_string ?>" class="arrow"><<</a> 
<?php
	}

	for ($p = 1; $p <= $total_pages; $p++) {

		$page_limit = ($p-1)*$__current['database']['per_page'];
		$page_limit_string = '/?l=' . (int)$page_limit;
		if ((int)$page_limit == 0) { 
			$page_limit_string = '';
		}
?>
		<a<?php 

	if ($limit == $page_limit) echo ' class="selected"';

	?> href="<?php echo '/' . $__language . '/' . $__current['link'][$__language] . $page_limit_string ?>"><?=$p?></a>

<?php
	}

	if ($page_next < $total_objects) {
?>
	<a href="<?php echo '/' . $__language . '/' . $__current['link'][$__language] . $page_next_limit_string ?>" class="arrow">>></a>
<?php
	}
?>
	</div>
<?php

}
//************************************************************************

?>
</div>
<?

include('templates/' . $__config['template'] . '/footer.php');

}
?>

 

here is my object_galerija.details.php where i need to show my date

 

<?php
include('templates/' . $__config['template'] . '/header.php');?>
 <div id="headerpocetna" style="width: 960px; height: 200px; margin-top:-235px;"></div>
<? include('templates/' . $__config['template'] . '/menu2.php');	




$object->gallery->getPhotos();



?>


<div id="content">

	<h1 style="padding-bottom:10px;">
        
        <a style="text-decoration:none; color:#237DB7;" href=" "><?=$__current['naslov'][$__language]?></a> - <?=$object->{'naziv_' . $__language}?>
        
        </h1>
       







        
        
        
        
	<div class="clear"></div>
        

<div style="float:left; width:350px; border-right:solid 1px #cccccc; margin-right:5px;" >

        
        

	 <p style=" padding-bottom:5px; font-size:11px;">Datum: 



	 <?php

$timee=date('d.m.Y',strtotime($object->{'datum'}));
echo $timee;
?>

	</p>
                                               
                                                           
</div>
<div style="float:left; width:360px; padding-left:10px:" >

	<p style=" padding-bottom:5px; font-size:11px;"><?=$object->{'opis_' . $__language}?></p>
          
                                               
                                                           
</div>

            <div class="clear"></div>
            
            
      
            
            
            
           
            
            
            
            
            
            
            
            
            
            <div class="clear"></div>
            
            
            <h2><?php echo $__l['galerija'] ?></h2>

		<div class="images-details" >
<?php
if (is_array($object->gallery->photos)) {
	foreach($object->gallery->photos as $photo) {





?>
			<a class="thickbox" href="/images/cache/objects/<?=$object->id?>/<?=$photo['filename']?>/w-800.jpg" rel="galler"><?

				?><img alt=""  src="/images/cache/objects/<?=$object->id?>/<?=$photo['filename']?>/h-98.jpg" /><?
			?></a>

<?php
	}
}
?>
			</div>
		</div>
          
        

<?php
include('templates/' . $__config['template'] . '/footer.php');
?>

 

and here is my page with form where i add date

 

<?php

$object = new S_Object;
$object->load((int)$_GET['id']);




	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                        galerija
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if (
		$_SERVER['REQUEST_URI'] == '/admin/index.php?page=objects&category=galerija&action=add'

	) {



$fieldGroups[1] = array(
	'title' => 'Opcije prikazivanja',
	'fields' => array(
		'naslovna' => array(
			'type' => 'checkbox',
			'name' => 'Prika&#382;i na stranici',
		),
		'posebna_ponuda' => array(
			'type' => 'checkbox',
			'name' => 'Izdvojeno',
		),
	),
);
$fieldGroups[2] = array(
	'title' => 'Podaci o objektu',
	'fields' => array(
		'lokacija' => array(
			'type' => 'string',
			'name' => 'Lokacija',
		),
		'kategorizacija' => array(
			'type' => 'date',
			'name' => 'Datum (dd.mm.gggg)',
		),


		'brdodatnihkreveta' => array(
			'type' => 'string',
			'name' => 'Klijent',
		),
		'udaljenostodmora' => array(
			'type' => 'string',
			'name' => 'Autor',
		),
		'zupanija' => array(
			'type' => 'select',
			'name' => 'Vrsta',
			'values' => $zupanije,
		),




	),
);
$fieldGroups[13] = array(
	'title' => 'Sadr&#382;aj projekta',
	'fields' => array(
		'eksterijer' => array(
			'type' => 'checkbox',
			'name' => 'Eksterijer',
		),
		'interijer' => array(
			'type' => 'checkbox',
			'name' => 'Interijer/Detalji',
		),
		'presjeci3d' => array(
			'type' => 'checkbox',
			'name' => 'Presjeci 3d',
		),
		'fotomontaze' => array(
			'type' => 'checkbox',
			'name' => 'Fotomonta&#382;e',
		),
		'animacija' => array(
			'type' => 'checkbox',
			'name' => 'Animacija/Prezentacija',
		),
		'katalogs' => array(
			'type' => 'checkbox',
			'name' => 'Katalozi stanova',
		),
		'tablag' => array(
			'type' => 'checkbox',
			'name' => 'Table za gradili&#353;ta',
		),
	),
);
$fieldGroups[3] = array(
	'title' => 'Naziv i opisi',
	'fields' => array(

		'naziv_hr' => array(
			'type' => 'string',
			'name' => 'Naziv - hrvatski',
			'show_title' => true,
		),
		'opis_hr' => array(
			'type' => 'textarea',
			'name' => 'Opis - hrvatski',
			'show_title' => false,
		),
		'naziv_en' => array(
			'type' => 'string',
			'name' => 'Naziv - engleski',
			'show_title' => true,
		),
		'opis_en' => array(
			'type' => 'textarea',
			'name' => 'Opis - engleski',
			'show_title' => false,
		),
	),
);
$fieldGroups[0] = array(
	'title' => '',
	'fields' => array(

		'type' => array(
			'type' => 'select2',
			'name' => '',
			'values' => $realestateTypes[$_GET['category']],
		),

	),
);

}

	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                       software
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if (
		$_SERVER['REQUEST_URI'] == '/admin/index.php?page=objects&category=software&action=add'

	) {

$fieldGroups[1] = array(
	'title' => 'Opcije prikazivanja',
	'fields' => array(
		'naslovna' => array(
			'type' => 'checkbox',
			'name' => 'Prika&#382;i na stranici',
		),
		'posebna_ponuda' => array(
			'type' => 'checkbox',
			'name' => 'Izdvojeno',
		),
	),
);

$fieldGroups[3] = array(
	'title' => 'Naziv i opisi',
	'fields' => array(

		'naziv_hr' => array(
			'type' => 'string',
			'name' => 'Naziv - hrvatski',
			'show_title' => true,
		),
		'opis_hr' => array(
			'type' => 'textarea',
			'name' => 'Opis - hrvatski',
			'show_title' => false,
		),
		'naziv_en' => array(
			'type' => 'string',
			'name' => 'Naziv - engleski',
			'show_title' => true,
		),
		'opis_en' => array(
			'type' => 'textarea',
			'name' => 'Opis - engleski',
			'show_title' => false,
		),
	),
);

$fieldGroups[0] = array(

	'fields' => array(

		'type' => array(
			'type' => 'select2',
			'values' => $realestateTypes[$_GET['category']],
		),

	),
);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                        novosti
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if (
		$_SERVER['REQUEST_URI'] == '/admin/index.php?page=objects&category=novosti&action=add'

	) {

$fieldGroups[1] = array(
	'title' => 'Opcije prikazivanja',
	'fields' => array(
		'naslovna' => array(
			'type' => 'checkbox',
			'name' => 'Prika&#382;i na stranici',
		),
		'posebna_ponuda' => array(
			'type' => 'checkbox',
			'name' => 'Izdvojeno iz ponude',
		),
		'kategorizacija' => array(
			'type' => 'date',
			'name' => 'Datum (dd.mm.gggg)',
		),
	),
);

$fieldGroups[3] = array(
	'title' => 'Naziv i opisi',
	'fields' => array(

		'naziv_hr' => array(
			'type' => 'string',
			'name' => 'Naziv - hrvatski',
			'show_title' => true,
		),
		'opis_hr' => array(
			'type' => 'textarea',
			'name' => 'Opis - hrvatski',
			'show_title' => false,
		),
		'naziv_en' => array(
			'type' => 'string',
			'name' => 'Naziv - engleski',
			'show_title' => true,
		),
		'opis_en' => array(
			'type' => 'textarea',
			'name' => 'Opis - engleski',
			'show_title' => false,
		),
	)
);
$fieldGroups[0] = array(

	'fields' => array(

		'type' => array(
			'type' => 'select2',
			'values' => $realestateTypes[$_GET['category']],
		),

	),
);
}

?>
<h1>Dodavanje <?php echo $title . ' '; ?></h1>
<?php
if (! empty($_GET['message'])) {
?>	
<div class="message">
	<?php echo $_REQUEST['message']; ?>
</div>	
<?php
}
?>
<script type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({

mode : 'textareas',

		theme: 'advanced',
		theme_advanced_toolbar_location: 'top',
		theme_advanced_toolbar_align: 'left',
theme_advanced_buttons1 : 'bold,italic,underline,separator,justifyleft,justifycenter,justifyright,fontsizeselect,forecolor,bullist,charmap,cleanup  ',
theme_advanced_buttons2 : '',
theme_advanced_buttons3 : ''


});
</script>
<form method="post" class="edit">
<?php
if (is_array($fieldGroups)) {
	foreach($fieldGroups as $fieldGroup) {
?>
	<h2 class="fieldset-title"><?=$fieldGroup['title']?></h2>
<?
		foreach($fieldGroup['fields'] as $f => $field) {
?>
	<fieldset>
<?
		if ($field['show_title'] !== false) {
?>
		<label for="input_<?=$f?>"><?php echo $field['name']; ?></label>
<?
		}

		if ($field['type'] == 'textarea') {
?>

		<textarea id="input_<?=$f?>" name="<?=$f?>"><?=$object->$f?></textarea>
<?
		}

		if ($field['type'] == 'checkbox') {
?>
		<input id="input_<?=$f?>" type="checkbox" name="<?=$f?>"<? if ($object->$f) echo ' checked="checked"'; ?> />
<?
		}

		if ($field['type'] == 'date') {
?>
		<input  value="<?=$object->$f?>" id="input_<?=$f?>" name="<?=$f?>"/>
<?
		}

		if ($field['type'] == 'numeric' || $field['type'] == 'string') {
?>
		<input id="input_<?=$f?>" type="text" name="<?=$f?>" value="<?=$object->$f?>" />
<?
		}

		if ($field['type'] == 'select') {

			if (! empty($fiels['table'])) {
				$select = runSQL("SELECT * FROM `" . $field['table'] . "`");
			} else {
				$select = $field['values'];
			}

			if (is_array($select)) {
			?><select name="<?=$f?>"><?

			foreach($select as $key => $option) {
				?><option<? if ($object->$f==$key) echo ' selected="selected"'; ?> value="<?=$key?>"><?=$option?>  </option><?
			}
			?></select><?
			}

		}
		if ($field['type'] == 'select2') {

			if (! empty($fiels['table'])) {
				$select = runSQL("SELECT * FROM `" . $field['table'] . "`");
			} else {
				$select = $field['values'];
			}

			if (is_array($select)) {
			?><select style="margin-left:-1000px;" name="<?=$f?>"><?

			foreach($select as $key => $option) {
				?><option<? if ($object->$f==$key) echo ' selected="selected"'; ?> value="<?=$key?>"><?=$option?>  </option><?
			}
			?></select><?
			}

		}








?>
	</fieldset>
<?
		}

		}
	}
?>
	<fieldset class="buttons">
		<input type="hidden" name="page" value="<?php echo $_GET['page']; ?>" />
		<input type="hidden" name="category" value="<?php echo $_GET['category']; ?>" />
		<input type="hidden" name="action" value="<?php echo $_GET['action']; ?>" />
		<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>" />
		<input type="submit" name="submit" value="Snimi" />
	</fieldset>

</form>


 

i know it is too much of code, but does that helps you?

Link to comment
https://forums.phpfreaks.com/topic/166218-beginer-date-help/#findComment-876575
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.