PHP Classes

How Use a a PHP Background Image on Sites based on the ASCOOS CMS Using the Package Background Selector: Select the background of a block with ASCOOS CMS

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-10-20 (Yesterday) RSS 2.0 feedNot yet rated by the usersTotal: 15 This week: 4All time: 11,370 This week: 14Up
Version License PHP version Categories
background-selector 1.0.1Custom (specified...5.6Graphics, Content management, Templates, G..., P...
Description 

Author

This package provides a component to select the background of a block with ASCOOS CMS.

It provides scripts that work as a component that can be installed in a site based on the ASCOOS CMS to allow the publishers to select the background of a block on a Web page.

This block component can make pages display a background image based on 3LT Themes Elements (Front, Frontpage, and EFP).

Innovation Award
PHP Programming Innovation award nominee
September 2024
Nominee
Vote
Many sites use background images to create a better visual impression.

In HTML pages, it is a matter of using CSS attributes to set the background image of a page or just a part of that page.

This package provides a user-friendly way to select background images for sites that use the ASCOOS CMS to choose the background image of a page block.

Manuel Lemos
Picture of ASCOOS CMS
  Performance   Level  
Name: ASCOOS CMS <contact>
Classes: 16 packages by
Country: Greece Greece
Innovation award
Innovation award
Nominee: 11x

Instructions

You can see a tutorial here.

Example

<?php
/**
 * __ _ ___ ___ ___ ___ ___ ____ _ __ ___ ___
 * / _` |/ / / __/ _ \ / _ \ / / / __/| '_ ` _ \ / /
 * | (_| |\ \| (_| (_) | (_) |\ \ | (__ | | | | | |\ \
 * \__,_|/__/ \___\___/ \___/ /__/ \___\|_| |_| |_|/__/
 *
 *
 ************************************************************************************
 * @ASCOOS-NAME : ASCOOS CMS 24' *
 * @ASCOOS-VERSION : 24.0.0 *
 * @ASCOOS-CATEGORY : Block (Frontend and Administrator Side) *
 * @ASCOOS-CREATOR : Drogidis Christos *
 * @ASCOOS-SITE : www.ascoos.com *
 * @ASCOOS-LICENSE : [Commercial] http://docs.ascoos.com/lics/ascoos/AGL.html *
 * @ASCOOS-COPYRIGHT : Copyright (c) 2007 - 2024, AlexSoft Software. *
 ************************************************************************************
 *
 * @package : Background Selector
 * @subpackage : Main Frontend File
 * @source : /[BLOCKS PATH]/background_selector/index.php
 * @fileNo : 5
 * @version : 1.0.1
 * @created : 2012-07-27 20:00:00 UTC+3
 * @updated : 2024-09-29 07:00:00 UTC+3
 * @author : Drogidis Christos
 * @authorSite : www.alexsoft.gr
 * @license : AGL-F
 *
 * @since PHP 8.2.0
 */

defined ("ALEXSOFT_RUN_CMS") or die("Prohibition of Access.");

global
$cms_site, $app, $cur_template, $frontpage, $efp;

$bg_date_start = $block->getParam('str', 'sdate', '');
$bg_date_end = $block->getParam('str', 'edate', '');
$bg_id = $block->getParam('str', 'id', '');
$bg_image = $block->getParam('str', 'image', '');
$bg_position = $block->getParam('str', 'position', '');
$bg_attachment = $block->getParam('str', 'attachment', '');
$bg_repeat = $block->getParam('str', 'repeat', '');
$bg_color = $block->getParam('str', 'color', '');

// If isset Background image and CSS Selector
if ( ($bg_id != '') && ($bg_image != '') )
{
   
// If given a start date
   
if ( $bg_date_start !='') $bg_sdate = (time() >= strtotime($bg_date_start)) ? true : false;
    else
$bg_sdate = true;

   
// If given an expiration date
   
if ( $bg_date_end != '') $bg_edate = (time() <= strtotime($bg_date_end)) ? true : false;
    else
$bg_edate = true;

   
// If we are within the limits of the given dates.
   
if ($bg_sdate && $bg_edate)
    {
       
// If selected Front 3LT Template.
       
$bgtpl = ( strcmp($block->getVar('front'), $cur_template) == 0) ? true : false;

       
// If selected Frontpage 3LT Template.
       
$bgfrontpage = ( strcmp($block->getVar('frontpage'), $frontpage) == 0) ? true : false;

       
// If selected EFP 3LT Template.
       
$bgefp = ( strcmp($block->getVar('efp'), $efp) == 0) ? true : false;

       
// If you have selected a 3LT Template.
       
if ($bgtpl || $bgfrontpage || $bgefp)
        {
           
$arr = [];
           
$text = "jQuery('".$bg_id."').css({";
            if (
$bg_image != '') $arr[] = '"background-image":"url('.$cms_site .'/themes/wallpapers/'.$bg_image.')"';
            if (
$bg_attachment != '') $arr[] = '"background-attachment":"'.$bg_attachment.'"';
            if (
$bg_position != '') $arr[] = '"background-position":"'.$bg_position.'"';
            if (
$bg_repeat != '') $arr[] = '"background-repeat":"'.$bg_repeat.'"';
            if (
$bg_color != '') $arr[] = '"background-color":"#'.$bg_color.'"';
           
$text .= implode(',', $arr)."});";
            unset(
$arr);
           
$app->addJAScript($text);
            unset(
$text);
        }
    }
}
?>


Details

[1.0.1] - 2024-09-29

FOR PHP >= 8.2.0

  • Added file Ascoos Cms License (`LICENSE_AGL-F.md`)
  • Updated file `install.php`
  • Updated file `params.php`
  • Updated file `index.php`
  • Updated file `.htaccess`
  • Updated file `params.json`
  • Updated language files

*

[1.0.0] - 2012-07-27

  • Initial release

Screenshots (2)  
  • screenshot-el.png
  • screenshot-en.png
Videos (2)  
  • Ascoos Cms App Explorer - Blocks List Management
  • Ascoos Cms Blocks - Edit Permissions
  Files folder image Files (42)  
File Role Description
Files folder imagehelp (22 files)
Files folder imagelanguages (8 files)
Accessible without login Plain text file .htaccess Data Auxiliary data
Accessible without login HTML file AGL-F.html Doc. Documentation
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login HTML file index.html Doc. Documentation
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file install.php Example Example script
Accessible without login Plain text file LICENSE_AGL-F.md Lic. License text
Accessible without login Plain text file params.json Data Auxiliary data
Accessible without login Plain text file params.php Example Example script
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (42)  /  help  
File Role Description
  Accessible without login Image file background_selector_scr001.png Icon Icon image
  Accessible without login Image file background_selector_scr002.png Icon Icon image
  Accessible without login Image file background_selector_scr003.png Icon Icon image
  Accessible without login Image file background_selector_scr004.png Icon Icon image
  Accessible without login Image file background_selector_scr005.png Icon Icon image
  Accessible without login Image file background_selector_scr006.png Icon Icon image
  Accessible without login Image file background_selector_scr007.png Icon Icon image
  Accessible without login Image file background_selector_scr008.png Icon Icon image
  Accessible without login Image file background_selector_scr009.png Icon Icon image
  Accessible without login Image file background_selector_scr010.png Icon Icon image
  Accessible without login Image file background_selector_scr011.png Icon Icon image
  Accessible without login Image file background_selector_scr012.png Icon Icon image
  Accessible without login Image file background_selector_scr013.png Icon Icon image
  Accessible without login Image file background_selector_scr014.png Icon Icon image
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login Image file scr-ascoos-explorer-000.png Icon Icon image
  Accessible without login Image file scr-installer-000.png Icon Icon image
  Accessible without login Image file scr-installer-001-1280.png Icon Icon image
  Accessible without login Image file scr-installer-002-1280.png Icon Icon image
  Accessible without login Image file scr-installer-003-1280.png Icon Icon image
  Accessible without login Plain text file tutorial.el.md Data Auxiliary data
  Accessible without login Plain text file tutorial.en.md Data Auxiliary data

  Files folder image Files (42)  /  languages  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Plain text file el-CY.php Class Class source
  Plain text file el-GR.php Class Class source
  Plain text file el.php Class Class source
  Plain text file en-GB.php Class Class source
  Plain text file en-US.php Class Class source
  Plain text file en.php Class Class source
  Accessible without login HTML file index.html Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
Downloadbackground-selector-2024-10-20.zip 2733KB
Downloadbackground-selector-2024-10-20.tar.gz
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
PHP Backwards Compatibility Library Download .zip .tar.gz Included in ASCOOS CMS Core Recommended
 Version Control Unique User Downloads Download Rankings  
 100%
Total:15
This week:4
All time:11,370
This week:14Up