Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6542373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:13:09+00:00 2026-05-25T11:13:09+00:00

With my custom CMS I’m developing I have a menu structures type module where

  • 0

With my custom CMS I’m developing I have a menu structures type module where the admin can create a menu structures for their website. Inside the db is the links table and I’m trying to figure out what I can do if the link has an actual image. I created a field called link_image however I just thought of what if the link is apart of a sprite which would have most of the time 3 parts of the image (active, hover, normal) or whatever or has its own sprite. How should I handle this if I want to store this information in the database.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:13:10+00:00Added an answer on May 25, 2026 at 11:13 am

    It barely fits SO’s format, but a cool question! I’m building my own CMS as we speak. Personally I don’t like image-links, but I do have a solution to offer.

    So lets get our concept together piece by piece:

    It all starts from the DB. Where you have column link_image as you said. That’s the images-key-name or however you wish to call it.. PS! I would recommend to hold the file name + extension in that column. Because some images may be JPEG and some PNG.

    Now you need some sort of a checkpoint, that checks whether the image-links or text-links are being used. You could do this individually on each link, but that most likely will look ugly.. So make some menu related setting, that sets the links type.. Lets call that setting: $cms_settings['main_menu_type'] = 'image';

    Now we are going to display the links:

    $current_page = (isset($_GET['pageid']) ? $_GET['pageid'] : NULL);
    
    define('MENU_IMAGES_DIR', 'images/main_menu/');
    
    if ($cms_settings['main_menu_type'] == 'image') {
        foreach ($links as $link) {
            echo '<a href="' . $link['href'] . '"><div style="background-image: ' . MENU_IMAGES_DIR . $link['link_image'] . ';" class="main_menu_image' . ($current_page == $link['id'] ? ' menu_current' : '') . '" title="' . $link['title'] . '" /></a><br />';
        }
    } else {
        foreach ($links as $link) {
            echo '<a href="' . $link['href'] . '">' . $link['title'] . '</a><br />';
        }
    }
    

    And the CSS makes difference:

    .main_menu_image {background-position: top; background-repeat: no-repeat; width: 100px; height: 30px;}
    .main_menu_image:hover {background-position: 0px 30px;}
    .main_menu_image.menu_current {background-position: bottom;}
    

    This method requires that, all the images are the same size.. 100x90px to be exact, in this case.. And sprite order from top to bottom is NORMAL | HOVER | ACTIVE (under active, I mean the current page)

    This is my concept in a nutshell. You have to personalize it of course, but its the basic concept and in theory it works.. Probably need to tweak the CSS a little, that menu_current link would have different hover or such.. but that’s not hard.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I create custom CMS sites and then go ahead for the backend/admin side. Is
I have a custom CMS and would like to add a shortcuts menu triggered
As a company specialized in developing custom CMS, we have been asked to deploy
I have a CMS app that allows custom fields to be added. One type
I have a custom CMS built with ASP.NET WebForms (you can see it in
So i have a custom CMS running under .Net 3.5 written entirely in c#.
Here's what I have: Custom-made C# CMS where the content is stored in a
I am creating a custom CMS and have built a login system and was
I am new to CakePHP and want an admin panel on my custom CMS
Let me elaborate on the question... I have a custom CMS (built on codeigniter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.