Home Private Messages Search
CPG Dragonfly™ CMS stopsoftwarepatents.eu petition banner
Toggle Content
 
Forums ⇒ DragonflyCMS ⇒ Themes ⇒ How do i create rotating images in my theme?


How do i create rotating images in my theme?
Announce themes that you have created, or ask questions about how to create/modify a theme in 9.x. Includes the Requests sub-forum.
Go to page Previous  1, 2
Post new topic    Reply to topic    Printer Friendly Page     Forum Index ⇒  Themes

View previous topic :: View next topic  
Author Message
ejoj
Newbie
Newbie

Offline Offline
Joined: Sep 21, 2007
Posts: 6

PostPosted: Tue Mar 18, 2008 5:07 pm
Post subject: Re: How do i create rotating images in my theme?

Og and trying to do a direct link to script gives me the 403 df error page
Here is a direct link for the script www.peugeot-sport-club...rotate.php

Sorry for doublepost, didn't know i couldn't edit


ejoj's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
SunOS-5.10-i86pc/2.2.8/4.1.22/4.4.4/9.2.1
Back to top
View user's profile
Savis
Newbie
Newbie

Offline Offline
Joined: Nov 05, 2007
Posts: 7

PostPosted: Wed Mar 19, 2008 3:12 pm
Post subject: Re: Using random topic images for new Posts - How to set it up?

ok updated information now you have an idea of what im trying to do ?

site is

www.eternalfate.com


Savis's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
CentOS 5, Apache 1.3.39, MySQL 4.1.21, PHP 5.2.5, Dragonfly CMS 9.2.2.1
Back to top
View user's profile Visit poster's website
ejoj
Newbie
Newbie

Offline Offline
Joined: Sep 21, 2007
Posts: 6

PostPosted: Wed Mar 19, 2008 4:28 pm
Post subject: Re: How do i create rotating images in my theme?

This is a solution I found working,I renamed the script to .png and remove the png in the array.
Then i made i htaccess file in the directory with the scripts and the pictures wich included this line
Code::
AddType application/x-httpd-php .png
I'm sure there are more elegant weays to do this, but hey it works atleast


ejoj's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
SunOS-5.10-i86pc/2.2.8/4.1.22/4.4.4/9.2.1
Back to top
View user's profile
Savis
Newbie
Newbie

Offline Offline
Joined: Nov 05, 2007
Posts: 7

PostPosted: Thu Mar 20, 2008 5:47 pm
Post subject: Re: Using random topic images for new Posts - How to set it up?

bump?


Savis's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
CentOS 5, Apache 1.3.39, MySQL 4.1.21, PHP 5.2.5, Dragonfly CMS 9.2.2.1
Back to top
View user's profile Visit poster's website
rlgura
1000+ Posts Club
1000+ Posts Club

Offline Offline
Joined: Mar 27, 2006
Posts: 1146
Location: Cleveland, OH USA
PostPosted: Fri Mar 21, 2008 11:37 am
Post subject: Re: Using random topic images for new Posts - How to set it

Actually, after posting this response, I thought of a much easier solution.
If you want it to always display a random image (meaning the same article will have a different topic icon everytime you view it), you might try this:

[ Edit by admin] Link removed and post merged with our forum 'STICKY' topic - more information provided on page one of this thread. [/edit]

Except make the modification to templates/news/index.html instead of header.html

_________________
Admin - Great Lakes Web Designs
Theme Designer - WebSite Guru Designs
Site Admin - Families with Food Allergies

rlgura's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.27-grsec/Apache 2.2.11/MySQL 5.0.67-community-log/PHP 5.2.8/DF 9.2.1
Back to top
View user's profile Visit poster's website
Savis
Newbie
Newbie

Offline Offline
Joined: Nov 05, 2007
Posts: 7

PostPosted: Mon Mar 24, 2008 5:17 pm
Post subject: Re: How do i create rotating images in my theme?

the problem with this is the fact that it will randomize the topic images on the page but ALL of the images will be the same insted of having diffrent images for each topic..


The best way i can think of doing this is to have a script that has a list of all of your images in a folder and when you submit the news it will bind that image to that topic randomly....

how to do this I have no clue...


Savis's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
CentOS 5, Apache 1.3.39, MySQL 4.1.21, PHP 5.2.5, Dragonfly CMS 9.2.2.1
Back to top
View user's profile Visit poster's website
Mel
Forum Admin
Forum Admin

Offline Offline
Joined: Jul 21, 2004
Posts: 1386
Location: Eastern Time Zone
PostPosted: Mon Mar 24, 2008 9:23 pm
Post subject: Re: How do i create rotating images in my theme?

t31os wrote:

What does this script do?
This script will rotate images in a set folder, so your random images need to go in a dedicated folder - eg. ' /YOURTHEME/images/random/ '

The above says...it is a script and a dedicated folder...?????? Confused

Did you read the beginning of this thread? I will make it easy for you: click here

_________________
DF TIPS | Upgrade| Find Your Signature Specs|
"A bug in the code is worth two in the documentation. "


Mel please enter your server specs in your user profile! Crying or Very sad
Back to top
View user's profile Visit poster's website
Savis
Newbie
Newbie

Offline Offline
Joined: Nov 05, 2007
Posts: 7

PostPosted: Thu Mar 27, 2008 3:27 pm
Post subject: Re: How do i create rotating images in my theme?

ok so why was my topic merged with this one before any one got a full understanding of what i was looking for?


Savis's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
CentOS 5, Apache 1.3.39, MySQL 4.1.21, PHP 5.2.5, Dragonfly CMS 9.2.2.1
Back to top
View user's profile Visit poster's website
Mel
Forum Admin
Forum Admin

Offline Offline
Joined: Jul 21, 2004
Posts: 1386
Location: Eastern Time Zone
PostPosted: Fri Mar 28, 2008 12:25 am
Post subject: Re: How do i create rotating images in my theme?

Savis wrote:
ok so why was my topic merged with this one before any one got a full understanding of what i was looking for?

And that is?....

We are trying to help you.
Please answer our questions so we can understand.
It the above posts do not help you then you need to explain in GREAT DETAIL.

_________________
DF TIPS | Upgrade| Find Your Signature Specs|
"A bug in the code is worth two in the documentation. "


Mel please enter your server specs in your user profile! Crying or Very sad
Back to top
View user's profile Visit poster's website
websmythe
Newbie
Newbie

Offline Offline
Joined: Nov 30, 2009
Posts: 35
Location: Canada
PostPosted: Sun Dec 20, 2009 12:46 am
Post subject: Re: How do i create rotating images in my theme?

djdevon3 wrote:
I haven't actually tried the code t31os posted but if it works then it is much more diverse than what I'm going to post.

I've archived t31os script here:
www.treasurecoastdesig...;p=377#377

And the one Kristin did for xsport which is much easier to manage but only does images. Good for random header images. Kristin's code is much smaller and simple to work with. I recommend this method to those daunted by t31os's code:
www.treasurecoastdesig...=1226#1226

I'm trying to use Kristin's solution for a rotating image, but Debug says that array & image vars are undefined. They aren't any defined any different than other vars in the file. I've I checked the Php manual and other links, but as I'm new to Php I'm kinda lost. Could someone point me in the right direction? Thanx.

Code::
themes/reDesign/theme.php
    * Notice line 160: Undefined variable: random_image
    * Notice line 160: Undefined variable: random_array

Code::
<!-- themes/reDesign/theme.php -->

$textcolor1 = '#009900';
$textcolor2 = '#000000';
$hr = 1; /* deprecated? */

$array = array('01.jpg', '02.jpg', '03.jpg');
$image = rand(0, count($array)-1);

$cpgtpl->assign_vars(array(
  ...
  'RAND_IMG' => $array[$image], <!-- * line 160 -->
  ...
));


websmythe's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.18-92.1.18.el5-Apache 2.0.63-MySQL 5.0.81-community-PHP 5.2.6-Dragonfly 9.2.1
Back to top
View user's profile Visit poster's website
Eestlane
I18N / L10N Lead Dev
I18N / L10N Lead Dev

Offline Offline
Joined: Apr 06, 2005
Posts: 1404
Location: Estonia
PostPosted: Mon Dec 21, 2009 4:44 pm
Post subject: Re: How do i create rotating images in my theme?

Something´s wrong. Could you paste the whole theme.php and check if the error was exactly that you posted.


Eestlane's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.0.63/5.0.67/5.2.8/9.2.1
Back to top
View user's profile Send e-mail Visit poster's website
websmythe
Newbie
Newbie

Offline Offline
Joined: Nov 30, 2009
Posts: 35
Location: Canada
PostPosted: Mon Dec 21, 2009 7:35 pm
Post subject: Re: How do i create rotating images in my theme?

Thanx for the reply. I cut and pasted the error displayed at the bottom of the the admin page. Here is the full error/notice list with all debug options turned on. The theme is reDesign2. I've already checked but I changed the names, from $array, $image and RAND_IMG to $random_array, $random_image & RANDOM_IMAGE, in case there was a conflict with any reserved words

Code::
SQL Queries:

includes/classes/blocks.php

    * 0.0007 - LINE 188: SELECT bid, bkey, title, content, url, blockfile, view, refresh, time FROM cms_blocks WHERE active='1' AND bid IN (1,8,7,2,5,9,4,6,3)

themes/reDesign/includes/cssmainmenu.php

    * 0.0007 - LINE 66: SELECT m.title as link, m.custom_title as title, m.view, m.active, m.inmenu, m.cat_id AS category, m.pos AS linkpos, c.name, c.image, c.pos AS catpos, c.link AS catlnk, c.link_type AS cattype FROM cms_modules AS m LEFT JOIN cms_modules_cat c ON (c.cid = m.cat_id)
    * 0.0003 - LINE 86: SELECT l.title, l.link, l.link_type, l.view, l.active, l.cat_id AS category, l.pos AS linkpos, c.name, c.image, c.pos AS catpos, c.link AS catlnk, c.link_type AS cattype FROM cms_modules_links AS l LEFT JOIN cms_modules_cat c ON (c.cid = l.cat_id)

modules/CPGNuCalendar/includes/functions.inc

    * 0.0005 - LINE 40: SELECT custom_title FROM cms_modules WHERE title='CPGNuCalendar'

modules/CPGNuCalendar/admin/adwait.inc

    * 0.0003 - LINE 31: SELECT COUNT(*) FROM cms_cpgnucalendar WHERE approved=0

modules/News/admin/adwait.inc

    * 0.0002 - LINE 19: SELECT COUNT(*) FROM cms_queue

modules/coppermine/admin/adwait.inc

    * 0.0002 - LINE 19: SELECT prefix FROM cms_cpg_installs WHERE dirname = 'coppermine'
    * 0.0001 - LINE 20: SELECT dirname FROM cms_cpg_installs WHERE cpg_id=1
    * 0.0003 - LINE 22: SELECT COUNT(*) FROM cms_cpg_pictures WHERE approved=0

themes/reDesign/includes/cssmainmenu.php

    * Notice line 31: Constant _MYATTACHMENTS_SPECIAL already defined
    * Notice line 264: Undefined index: cat_name

blocks/block-Languages.php

    * CMS Warning line 24: Multilingual is off

themes/reDesign/theme.php

    * Notice line 160: Undefined variable: random_image
    * Notice line 160: Undefined variable: random_array

PHP:
<?php
/*********************************************
CPG Dragonfly™ CMS
********************************************
Copyright © 2004 - 2009 by CPG-Nuke Dev Team
dragonflycms.org

Dragonfly is released under the terms and conditions
of the GNU GPL version 2 or any later version

$Source: /cvs/themes/reDesign/theme.php,v $
$Revision: 1.40 $
$Author: estlane $
$Date: 2009/02/07 16:07:27 $
$Version: 9.2.1.5
**********************************************/
if (!defined('CPG_NUKE')) { exit; }

//Required Dragonfly version
define('THEME_VERSION', '9.2');

/* Text color on security image, THIS_THEME/images/code_bg.png */
$gfxcolor = '#000000';

/* Some background colours used by DF */
$bgcolor1 = '#FFFFFF'; /*topics, modules admin*/
$bgcolor2 = '#F2F9F2';
$bgcolor3 = '#F2FFFF';/*topics*/
$bgcolor4 = '#D7FFD7';/*modules admin*/
$textcolor1 = '#009900';
$textcolor2 = '#000000';

$hr = 1; /*deprecated?*/


// random image at top in header
//
$random_array = array('keelebanner1.jpg', 'keelebanner2.jpg', 'keelebanner3.jpg', 'keelebanner4.jpg', 'keelebanner5.jpg', 'keelebanner6.jpg', 'keelebanner7.jpg', 'keelebanner8.jpg', 'keelebanner9.jpg' );
$random_image = rand(0, count($random_array)-1);


/* Beginning of an usual table of untemplated modules */
function OpenTable() {
global
$module_name, $in_coppermine;

//$in_coppermine as it allows any module name for coppermine
//(should do the same with Forums in future?)

if ($module_name == 'Forums' || isset($in_coppermine)) {
echo
'<div>';
} else {
echo
'<div class="table1">';
}
}
/* End of an usual table of untemplated modules */
function CloseTable() {echo '</div>';}


/* Beginning of some subtable in untemplated modules */
function OpenTable2() {echo '<div class="table2">';}
/* End of some subtable in untemplated modules */
function CloseTable2() {echo '</div>';}


function
themeheader() {
global
$slogan, $sitename, $banners, $mainindex, $adminindex, $cpgtpl, $site_logo, $BASEHREF,
$CPG_SESS, $MAIN_CFG, $pagetitle, $userinfo, $module_name, $home, $Blocks, $my_page_title, $multilingual, $currentlang;

/* CSS Menu */
if ($MAIN_CFG['global']['admingraphic'] & 4) {
include(
'themes/'.$CPG_SESS['theme'].'/includes/cssmainmenu.php');
}

//include file to have proper language selection URL (or prevtheme)
include_once('themes/'.$CPG_SESS['theme'].'/includes/valikurl.php');

$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
$pngfix = 0;
$specific = 0;
if (
preg_match('#MSIE ([0-6].[0-9]{1,2})#', $user_agent)) {
$specific = 'ie6.css';
$pngfix = 1;
} else if (
preg_match('#Opera/([0-9].[0-2][0-9])#', $user_agent)) {
$specific = 'opera_merlin.css';
} else if (isset(
$_SESSION['SECURITY']['UA']) && $_SESSION['SECURITY']['UA'] == 'Safari') {
$specific = 'safari.css';
}


//We want to use some strings, which exists only in forums.php languagefile, it may cause a small downtime though
if (!isset($lang['Back_to_top'])) {
get_lang('forums');
global
$lang;
}
if (!
defined('_PASSWORDLOST')) { get_lang('your_account'); }


/*Add left blocks to header.html*/
$Blocks->display('l');
/*Add right blocks to header.html*/
$Blocks->display('r');

$cpgtpl->assign_vars(array(
'BROWSER_CSS' => $specific ? "\n".'<link rel="stylesheet" type="text/css" href="themes/'.$CPG_SESS['theme'].'/style/browsers/'.$specific.'" />'."\n" : "\n",
'PNG_FIX' => $pngfix ? '<script defer="defer" type="text/javascript" src="themes/'.$CPG_SESS['theme'].'/javascript/pngfix.js"></script>'."\n" : '',
'PUBLIC_HEADER' => !defined('ADMIN_PAGES'),
'CURRENT_URL' => ereg_replace('&','&amp;',get_uri()),
'B_L_VISIBLE' => $Blocks->hideblock('600') ? ' style=" display: none"' : '',
'B_R_VISIBLE' => $Blocks->hideblock('601') ? ' style=" display: none"' : '',
'S_MAIN_MENU' => isset($mmcontent) ? $mmcontent : false,
'S_LIMAGE' => ($Blocks->l)? ($Blocks->hideblock('600')? 'left_plus' : 'left_minus') : '',
'S_RIMAGE' => ($Blocks->r)? ($Blocks->hideblock('601')? 'right_plus' : 'right_minus') : '',
'S_IS_ADMIN' => is_admin(),
'ALL_OK' => !$MAIN_CFG['global']['maintenance'] || is_admin(),
'S_CAN_ADMIN' => can_admin(),
'S_IS_USER' => is_user(),
'B_ANONYMOUS' => !is_user(),
'S_NEW_PM' => is_user() && is_active('Private_Messages') && ($userinfo['user_new_privmsg'] > 0)?(($userinfo['user_new_privmsg']>1)?$lang['You_new_pms']:$lang['You_new_pm']):false,
'S_LOGO' => $site_logo,
'S_SITENAME' => $sitename,
'S_USER_NAME' => $userinfo['username'],
'S_LOGINRDRT' => (isset($CPG_SESS['user']['redirect']) ? $CPG_SESS['user']['redirect'] : getlink()),
'S_REG_ALLOWED' => $MAIN_CFG['member']['allowuserreg'],
'S_NOT_NEWS' => ($module_name != 'News') || $home,
'MY_PAGE_TITLE' => (($module_name != 'Forums') && ($module_name != 'Wiki') && ($module_name != 'coppermine'))? '<a href="'.$mainindex.'">'._HOME.'</a> '._BC_DELIM.' '.$pagetitle : '',
'CUR_LANGUAGE' => $currentlang,
'S_FORUMS' => _ForumsLANG,
'S_DOWNLOADS' => is_active('Downloads') ? _DownloadsLANG : false,
'S_MY_ACCOUNT' => is_user() ? _Your_AccountLANG : _BREG,
'S_ADMINISTR' => _ADMINISTRATION,
'BC_DELIM' => _BC_DELIM,
'S_BANNER_ACT' => $banners,
'S_BANNER' => ($banners) ? viewbanner() : '',
'S_EDIT' => _EDIT,
'S_MULTILANG' => $multilingual,
'S_LANGUAGES' => $multilingual? show_langs():'',
'S_SEARCH_ACT' => is_active('Search'),
'U_SEARCH' => getlink('Search'),
'U_MAININDEX' => $mainindex,
'U_LOGOUT' => getlink('Your_Account&amp;op=logout&amp;redirect'),
'U_REGISTER' => getlink('Your_Account&amp;file=register'),
'U_PASSLOSS' => getlink('Your_Account&amp;op=pass_lost'),
'U_DOWNLOADS' => getlink('Downloads'),
'U_FORUMS' => getlink('Forums'),
'U_LOG_IN' => getlink('Your_Account'),
'U_MY_ACCOUNT' => getlink(is_user() ? 'Your_Account' : 'Your_Account&amp;file=register'),
'U_PM' => getlink('Private_Messages'),
'U_ESTONIAN' => valikvastus('newlang','estonian'),
'U_ENGLISH' => valikvastus('newlang','english'),
'U_ADMININDEX' => $adminindex,
'U_NEWSADMIN' => adminlink('News&amp;edit='),
'S_LASTVISIT' => is_user() ? sprintf($lang['You_last_visit'], formatDateTime($userinfo['user_lastvisit'], _DATESTRING)) : '',
'S_TIMENOW' => sprintf($lang['Current_time'], formatDateTime(time(), _DATESTRING)),
'S_NEW_POSTS' => $lang['New_posts'],
'S_CLOSE_WIN' => $lang['Close_window'],
'BACK_TO_TOP' => $lang['Back_to_top'],
'PM_IMAGE' => 'themes/'.$CPG_SESS['theme'].'/images/forums/lang_'.$currentlang.'/icon_contact_pm.gif',
'WWW_IMAGE' => 'themes/'.$CPG_SESS['theme'].'/images/forums/lang_'.$currentlang.'/icon_contact_www.gif',
'BASE_URL' => $BASEHREF,
'RANDOM_IMAGE' => $random_array[$random_image],
'HEADVARS_OK' => 1 //makes possible to check if we need to reassign some vars in footer if this is false
));

}

function
themefooter() {
global
$MAIN_CFG, $cpgtpl, $banners;

if (
$MAIN_CFG['global']['maintenance'] && !is_admin()) {
echo
'</body></html>';
return;
}

$cpgtpl->assign_vars(array(
'S_BANNER_ACT' => $banners,
'S_BANNER' => ($banners) ? viewbanner() : '',
'S_FOOTER' => footmsg()
));


/*
In case the template array gets emptied, i.e during forums admin messages
We assign some again, that are also used in footer
*/
if (!isset($cpgtpl->_tpldata['.'][0]['HEADVARS_OK'])) {
global
$CPG_SESS, $mainindex, $adminindex;

/* CSS Menu */
if ($MAIN_CFG['global']['admingraphic'] & 4) {
include(
'themes/'.$CPG_SESS['theme'].'/includes/cssmainmenu.php');
}
//We want to use some strings, which exists only in forums.php languagefile, it may cause a small downtime though
if (!isset($lang['Back_to_top'])) {
get_lang('forums');
global
$lang;
}
if (!
defined('_PASSWORDLOST')) { get_lang('your_account'); }

$cpgtpl->assign_vars(array(
'CURRENT_URL' => ereg_replace('&','&amp;',get_uri()),
'S_TIMENOW' => sprintf($lang['Current_time'], formatDateTime(time(), _DATESTRING)),
'S_IS_USER' => is_user(),
'S_LASTVISIT' => is_user() ? sprintf($lang['You_last_visit'], formatDateTime($userinfo['user_lastvisit'], _DATESTRING)) : '',
'BACK_TO_TOP' => $lang['Back_to_top'],
'S_MAIN_MENU' => isset($mmcontent) ? $mmcontent : false,
'U_MAININDEX' => $mainindex,
'U_DOWNLOADS' => getlink('Downloads'),
'U_FORUMS' => getlink('Forums'),
'U_MY_ACCOUNT' => getlink(is_user() ? 'Your_Account' : 'Your_Account&amp;file=register'),
'U_ADMININDEX' => $adminindex,
'S_DOWNLOADS' => is_active('Downloads') ? _DownloadsLANG : false,
'S_FORUMS' => _ForumsLANG,
'S_MY_ACCOUNT' => is_user() ? _Your_AccountLANG : _BREG,
'S_ADMINISTR' => _ADMINISTRATION
));
}


$cpgtpl->set_filenames(array('footer' => 'footer.html'));
$cpgtpl->display('footer');
}




/***********************************************************************************

string theme_open_form

Creates start tag for form
$get_link : link for action default blank
$form_name : useful for styling and nbbcode
$legend: optional string value is used in form lagend tag
$border: optional use 1 to not show border on fieldset from stylesheet
************************************************************************************/
function theme_open_form($link, $form_name=false, $legend=false,$tborder=false) {
$leg = $legend ? "<legend>$legend</legend>" : '';
$bord = $tborder ? $tborder : '';
$form_name = $form_name ? ' id="'.$form_name.'"' :'';
return
'<form method="post" action="'.$link.'"'.$form_name.' enctype="multipart/form-data" accept-charset="utf-8"><fieldset '.$bord.'>'.$leg;
}

function
theme_close_form() {
return
'</fieldset></form>';
}



/***********************************************************************************

string theme_yesno_option

Creates 2 radio buttons with a Yes and No option
$name : name for the <input>
$value: current value, 1 = yes, 0 = no

************************************************************************************/
function theme_yesno_option($name, $value=0) {
/*$sel[(!$value)] = '';
$sel[$value] = ' selected="selected"';*/

$sel = array('','');
$sel[$value] = ' checked="checked"';

$select = '<input type="radio" name="'.$name.'" id="'.$name.'" value="1"'.$sel[1].' />
<label class="rdr" for="'
.$name.'">'._YES.'</label>
<input type="radio" name="'
.$name.'" id="'.$name.'" value="0" '.$sel[0].' />
<label class="rd" for="'
.$name.'">'._NO.'</label> ';
return
$select;
}




/***********************************************************************************

string theme_select_option

Creates a selection dropdown box of all given variables in the array
$name : name for the <select>
$value: current/default value
$array: array like array("value1","value2")

************************************************************************************/
function theme_select_option($name, $value, $array) {
$sel[$value] = ' selected="selected"';
$select = '<select class="set" name="'.$name.'" id="'.$name."\">\n";
foreach(
$array as $var) {
$select .= '<option'.(isset($sel[$var])?$sel[$var]:'').">$var</option>\n";
}
return
$select.'</select>';
}



/***********************************************************************************

string theme_select_box

Creates a selection dropdown box of all given variables in the multi array
$name : name for the <select>
$value: current/default value
$array: array like array("value1 => title1","value2 => title2")

************************************************************************************/
function theme_select_box($name, $value, $array) {
$select = '<select class="set" name="'.$name.'" id="'.$name."\">\n";
foreach(
$array as $val => $title) {
$select .= "<option value=\"$val\"".(($val==$value) ? ' selected="selected"' : '').">$title</option>\n";
}
return
$select.'</select>';
}


websmythe's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.18-92.1.18.el5-Apache 2.0.63-MySQL 5.0.81-community-PHP 5.2.6-Dragonfly 9.2.1
Back to top
View user's profile Visit poster's website
websmythe
Newbie
Newbie

Offline Offline
Joined: Nov 30, 2009
Posts: 35
Location: Canada
PostPosted: Mon Dec 21, 2009 7:50 pm
Post subject: Re: How do i create rotating images in my theme?

Forgot to include... DF recognizes the <div> and <img> statements as it displays the ALT value for the image, and the CSS correctly sizes the image space on the page. RANDOM_IMAGE is called in header.html as:

Code::
<div class="random_image">
     <img src="{THEME_PATH}/images/keele/random/{RANDOM_IMAGE}"  alt="Feature Image" border="0" /> 
</div> 


websmythe's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.18-92.1.18.el5-Apache 2.0.63-MySQL 5.0.81-community-PHP 5.2.6-Dragonfly 9.2.1
Back to top
View user's profile Visit poster's website
Eestlane
I18N / L10N Lead Dev
I18N / L10N Lead Dev

Offline Offline
Joined: Apr 06, 2005
Posts: 1404
Location: Estonia
PostPosted: Mon Dec 21, 2009 7:51 pm
Post subject: Re: How do i create rotating images in my theme?

Put
PHP:
// random image at top in header
//
$random_array = array('keelebanner1.jpg', 'keelebanner2.jpg', 'keelebanner3.jpg', 'keelebanner4.jpg', 'keelebanner5.jpg', 'keelebanner6.jpg', 'keelebanner7.jpg', 'keelebanner8.jpg', 'keelebanner9.jpg' );
$random_image = rand(0, count($random_array)-1);
inside the themeheader function or add them to globals if you want to use them in other functions as well.


Eestlane's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.0.63/5.0.67/5.2.8/9.2.1
Back to top
View user's profile Send e-mail Visit poster's website
websmythe
Newbie
Newbie

Offline Offline
Joined: Nov 30, 2009
Posts: 35
Location: Canada
PostPosted: Tue Jan 05, 2010 11:10 pm
Post subject: Re: How do i create rotating images in my theme?

Eestlane wrote:
Put ...[see above]... inside the themeheader function or add them to globals if you want to use them in other functions as well.
Thanx.
Works like a charm.


websmythe's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.18-92.1.18.el5-Apache 2.0.63-MySQL 5.0.81-community-PHP 5.2.6-Dragonfly 9.2.1
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic    Reply to topic    Printer Friendly Page    Forum Index ⇒  Themes
Page 2 of 2
All times are GMT
Go to page Previous  1, 2



Jump to:  


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


 
   Toggle Content User Info

Welcome Anonymous

Nickname
Password
(Register)

   Toggle Content Last CVS commits
· Fixed .ico Expires header.
· Removed domain name from cookies so subdomains wont access them anymore.
· CSS and JS, case insensitives.
· CSS and JS, send correct HTTP 1.1 headers and fixed issues where themes and...
· Further security class improvements.
· 301 redirects on LEO changes
· Option to force 3xx http status codes
· Validate googlebot.com and google.com crawlers.
· CCBot
· Rss with etag and atom.

閱讀詳細內容...

   Toggle Content Community

Support for DragonflyCMS in a other languages:

Deutsch
Español

   Toggle Content X-links
UltraEdit Browse Happy logo Firefox MySQL PostgreSQL Valid CSS! Valid XHTML 1.0! Unicode Encoded Badge NukeBiz Resources Raven DragonflyCMS Dedicated Now InsideSupport Lampe Berger

You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
Interactive software released under GNU GPL, Code Credits, Privacy Policy