Add/Edit Banner
Overview
The Add Banner page is a comprehensive form for creating and editing banner advertisements in ComusThumbz. It supports two banner types: Image banners (uploaded files or hotlinked URLs) and HTML banners (custom HTML/CSS content). The form includes sponsor/sub-sponsor selection, placement zone assignment, scheduling options, category targeting, and real-time preview functionality. The page also supports banner copying with pre-populated fields.
Location: Navigate to this page via Admin Panel → Advertising → Add Banner or access directly via ct/admin/addbanner.php
[Screenshot: add-banner-main-interface]
Getting to This Page
- Navigate to Admin Panel → Advertising
- Click Add Banner link
- Alternatively, click "Add New Banner" on the Banner Management page
- To edit, click "Edit" on an existing banner (loads with ?id=X)
- To copy, click "Copy" on an existing banner (loads with ?copy=1&...)
This page serves three purposes: creating new banners, editing existing banners, and copying banners. The interface adapts based on the mode.
System Requirements
This page requires sponsors, banner zones, and categories to be configured before creating banners. At least one active sponsor and one active zone must exist.
PHP Requirements
Required PHP Extensions
Required PHP Functions
Folder Permissions
Network Requirements
Features & UI Elements
Page Header
[Screenshot: add-banner-header]
Copy Notice Banner
[Screenshot: add-banner-copy-notice]
Appears when copying a banner:
Copying Banner: You are creating a copy of an existing banner. The form has been pre-filled with the original banner's data. Make any desired changes and click "Create Banner" to save the copy.
Navigation Buttons
Same as Banner Management page - links to all banner-related pages.
Section 1: Basic Information
[Screenshot: add-banner-basic-info]
Section 2: Banner Type
[Screenshot: add-banner-type-selection]
Two clickable options:
Selection toggles which content section is visible.
Section 3a: Banner Image (for Image type)
[Screenshot: add-banner-image-upload]
Upload Methods:
File Upload:
- Drag and drop supported
- File type validation
- Size validation (5MB max)
- Automatic dimension detection
Hotlink URL:
- URL input field
- "Check Dimensions" button to fetch image info
- Automatic dimension detection
Preview Container:
Shows after file selection or hotlink check:
- Image preview (max 300px height)
- Width, Height, File Size information
Section 3b: HTML Banner Content (for HTML type)
[Screenshot: add-banner-html-editor]
HTML Guidelines:
- Use
%referurlhere%as placeholder for click URL - Include inline CSS (external stylesheets may not work)
- Keep JavaScript minimal and inline
- Test in different browsers
Example Code:
<div style="width:300px;height:250px;background:#f0f0f0;border:1px solid #ccc;text-align:center;padding:20px;">
<h3>Your Ad Title</h3>
<p>Compelling ad text here</p>
<a href="%referurlhere%" style="background:#007cba;color:white;padding:10px 20px;text-decoration:none;border-radius:5px;">Click Here</a>
</div>
HTML Preview Container:
Shows rendered HTML preview when "Preview HTML" button clicked.
Section 4: Banner Settings
[Screenshot: add-banner-settings]
Section 5: Categories
[Screenshot: add-banner-categories]
- Up to 10 categories can be selected
- Categories are ordered by selection order (priority)
- Used for targeted banner display on category pages
Form Actions
[Screenshot: add-banner-form-actions]
Loading Overlay
Shows during form submission with spinner and "Processing banner..." message.
HTML Banner Processing
When saving HTML banners, the system automatically processes the content:
Wildcard Replacement
%referurlhere% is replaced with a click tracking URL:
{baseurl}/bannerclick.php?url={encodedclickurl}
Processing Rules
- Iframe src attributes - URL-encoded for embed parameters
- Anchor href attributes - Direct replacement
- onclick handlers - JavaScript-escaped
- Remaining occurrences - Simple replacement
iframe Wrapping
If an iframe doesn't contain %referurlhere%, it's wrapped in a clickable div with transparent overlay for click tracking.
Step-by-Step Usage
Creating a New Image Banner
- Navigate to Admin Panel → Advertising → Add Banner
- Enter a descriptive Banner Title
- Select the Sponsor from dropdown
- Optionally select a Sub-Sponsor
- Select the Banner Placement (zone)
- Enter the destination Click URL
- Ensure "Image Banner" is selected
- Choose upload method:
- File Upload: Click "Choose File" or drag/drop an image
- Hotlink: Enter URL and click "Check Dimensions"
- Review auto-detected dimensions
- Optionally set Weight, Start/End Dates, and Status
- Select up to 10 Categories
- Click Create Banner
Creating an HTML Banner
Navigate to Admin Panel → Advertising → Add BannerFill in basic information (title, sponsor, placement, click URL)Click "HTML Banner" type optionPaste or type your HTML code in the editor
- Use
%referurlhere%for click tracking links - Click Preview HTML to verify rendering
- Set dimensions manually
- Configure settings and categories
- Click Create Banner
Editing an Existing Banner
- From Banner Management, click Edit on a banner
- Page loads with all fields pre-populated
- Make desired changes
- For image banners, upload new file to replace existing
- Click Update Banner
Copying a Banner
- From Banner Management, click Copy on a banner
- Page loads with copy data (title has " (Copy)" appended)
- Status is set to "inactive" by default
- Modify any fields as needed
- Click Create Copy
AJAX Actions
File Upload Validation
File Naming Convention:
banner{sponsorid}{timestamp}.{extension}
Example: banner51704067200.jpg
Troubleshooting
Common Errors
"Title, sponsor, placement, and click URL are required"
Cause: Required fields not filled
Solution: Ensure all required fields have values
"Either upload a file or provide a hotlink URL"
Cause: Image banner without image source
Solution: Upload a file or enter a valid hotlink URL
"HTML content is required for HTML banners"
Cause: HTML banner type selected but no content
Solution: Enter HTML code in the editor
"Invalid hotlink URL"
Cause: URL doesn't pass filtervar() validation
Solution: Use a complete URL starting with http:// or https://
"Could not get image dimensions"
Cause: Remote image not accessible or invalid
Solution:
- Verify URL is correct
- Check if image is publicly accessible
- Try accessing URL directly in browser
"Failed to upload file"
Cause: Server permission or disk space issue
Solution:
- Verify images/banners/ folder exists with write permissions
- Check available disk space
- Review PHP upload settings
Preview not showing for HTML banner
Cause: JavaScript error in HTML content
Solution:
- Check browser console for errors
- Simplify HTML content
- Remove external scripts that may be blocked
Dimension Detection Issues
If hotlink dimension detection fails:
- Some servers block remote requests
- URL may require authentication
- Image may be served dynamically
- Manually enter width and height instead
Translatable Strings
The following strings should be added to backendtranslations.md:
addbannertitleadd = "Add New Banner"
addbannertitleedit = "Edit Banner"
addbannertitlecopy = "Copy Banner"
addbannerbreadcrumbadd = "Add"
addbannerbreadcrumbedit = "Edit"
addbannerbreadcrumbcopy = "Copy"
addbannersubtitle = "Create and manage banner advertisements with support for images and HTML content"
addbannercopynotice = "Copying Banner: You are creating a copy of an existing banner. The form has been pre-filled with the original banner's data. Make any desired changes and click \"Create Banner\" to save the copy."
addbannersectionbasic = "Basic Information"
addbannersectiontype = "Banner Type"
addbannersectionimage = "Banner Image"
addbannersectionhtml = "HTML Banner Content"
addbannersectionsettings = "Banner Settings"
addbannersectioncategories = "Categories"
addbannerfieldtitle = "Banner Title"
addbannerfieldsponsor = "Sponsor"
addbannerfieldsubsponsor = "Sub-Sponsor"
addbannerfieldplacement = "Banner Placement"
addbannerfieldclickurl = "Click URL"
addbannerfieldwidth = "Width (px)"
addbannerfieldheight = "Height (px)"
addbannerfieldweight = "Weight"
addbannerfieldstartdate = "Start Date"
addbannerfieldenddate = "End Date"
addbannerfieldstatus = "Status"
addbannerfieldhtmlcontent = "HTML Content"
addbannerselectsponsor = "Select Sponsor"
addbannerselectsubsponsor = "Select Sub-Sponsor (Optional)"
addbannerselectplacement = "Select Placement"
addbannertypeimage = "Image Banner"
addbannertypeimagedesc = "Upload an image file or use a hotlink URL"
addbannertypehtml = "HTML Banner"
addbannertypehtmldesc = "Create custom HTML/CSS banner content"
addbanneruploadfile = "Upload File"
addbanneruploadfiledesc = "Upload an image file from your computer"
addbannerhotlink = "Hotlink URL"
addbannerhotlinkdesc = "Link to an image hosted elsewhere"
addbannerchoosefile = "Choose File"
addbannersupportedformats = "Supported formats: JPG, PNG, GIF, WebP (Max 5MB)"
addbannercheckdimensions = "Check Dimensions"
addbannerpreviewhtml = "Preview HTML"
addbannerhtmlguidelines = "HTML Banner Guidelines"
addbannerhtmlplaceholdertip = "Use %referurlhere% as a placeholder for the click URL"
addbannerhtmlinlinecss = "Include inline CSS for styling (external stylesheets may not work)"
addbannerhtmlminimaljs = "Keep JavaScript minimal and inline if needed"
addbannerhtmltestbrowsers = "Test your banner in different browsers"
addbannerhtmlexample = "Example"
addbannercategorieslimit = "Select Categories (Up to 10)"
addbannercategorieswarning = "Maximum 10 categories allowed"
addbannerbtncancel = "Cancel"
addbannerbtncreate = "Create Banner"
addbannerbtnupdate = "Update Banner"
addbannerbtncopy = "Create Copy"
addbannerprocessing = "Processing banner..."
addbannersuccess = "Banner saved successfully"
addbannererrorrequired = "Please fill in all required fields"
addbannererrorimagerequired = "Please upload a file or provide a hotlink URL for image banners"
addbannererrorhtmlrequired = "Please provide HTML content for HTML banners"
addbannerpreviewwidth = "Width"
addbannerpreviewheight = "Height"
addbannerpreviewsize = "File Size"
addbannerpreviewexternal = "External"
Version History
Related Documentation
- Banner Management - Viewing and managing banners
- Banner Zones - Creating placement zones
- Sponsors Management - Managing sponsors
- Sub-Sponsors - Managing sub-sponsors