2012.04.12 03:41, saimhe rašė:
>> nu kopinta is knygos; tikrai veike tinkamai
>
> Pagaliau daėjo. Kaip gerai, kad mokiausi ne iš dešimties metų senumo
> knygų, o iš aktyviai tobulinamo svetimo kodo ir php.net/manual/ .
Juokinga, ane?
O aš nesenai apturėjau "šedevrą":
išvedimas juzeriui, Wordpress'e:
<?php $image1 = get_post_meta($post->ID, 'dekciw_bg_image_1', TRUE); ?>
<?php if($image1) : ?>
<div id="slide1" class="bg-slide">
<img src="<?php echo $image1; ?>"/>
</div>
<?php endif; ?>
....
<?php $image5 = get_post_meta($post->ID, 'dekciw_bg_image_5', TRUE);?>
<?php if($image5) : ?>
<div id="slide5" class="bg-slide">
<img src="<?php echo $image5; ?>"/>
</div>
<?php endif; ?>
išvedimas į formą:
....
foreach ($portfolio_meta_box['fields'] as $field) {
$meta = get_post_meta($post->ID, $field['id'], true);
echo '<tr>',
'<th style="width:20%"><label for="', $field['id'],
'">', $field['name'], '</label></th>',
'<td>';
switch ($field['type']) {
case 'text':
echo '<input type="text" name="', $field['id'], '"
id="', $field['id'], '" value="', $meta ? $meta : $field['std'],
'" size="30" style="width:97%" />', '<br />', $field['desc'];
break;
....
, kai
$portfolio_meta_box = array(
'fields' => array(
array( 'name' => 'BG Image #1',
'desc' => '',
'id' => 'dekciw_bg_image_1',
'type' => 'text',
'std' => ''),
....
array( 'name' => 'BG Image #5',
'desc' => '',
'id' => 'dekciw_bg_image_5',
'type' => 'text',
'std' => ''),
)
);
Jiems ką moka už atspausdintus simbolius?
Sekretorės - mašininkės atsirado.
--
ejs