Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Applying CSS only to table in Single Upload Form  (Read 8820 times)

0 Members and 1 Guest are viewing this topic.

EME

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 8
Applying CSS only to table in Single Upload Form
« on: December 30, 2016, 10:15:20 am »

I am trying to shrink the width of the table on the single upload page and remove cell borders.  I have accomplished it by adding the following CSS to style.css in the Water Drop theme:

   form#cpgform table {
       border-collapse: collapse;
       width:50%;
   }

However, I discovered when testing the site after this change that it has applied the css to other tables throughout the site, such as the one activated by the admin's config button.  That sent me looking through upload.php to see what the HTML looked like.  Around line 731 I found an instance of the function starttable which looks to be generating it:

    // Open the form table.
    starttable('100%', $upload_table_header, 2);

That function is defined around line 4047 of themes.inc.php:

    // Function to start a 'standard' table

    function starttable($width = '-1', $title = '', $title_colspan = '1', $zebra_class = '', $return = false)

By changing the value of $width in the above-mentioned instance in upload.php I am able to get the width where I want it.  But from what I can see the function does not support inline CSS.  So I can't apply border-collapse: collapse.

I did figure out that I can add a class to the single upload form by rewriting the function as follows:

    // Open the form table.
    starttable('100%', $upload_table_header, 2, 'uploadtest');

That then allows me to apply CSS to the single upload page with the following:

   form#cpgform table.maintable.uploadtest {
       border-collapse: collapse;
       width:50%;
   }

My question has two parts:

1) It looks like adding the class where I did is only applying it to the single upload page.  Testing has so far supported that.  But I don't know your system terribly well.  Is that class being applied somewhere else that I don't see at the moment?

2) Is there a way to execute this change without altering the core file upload.php? I am not terribly familiar with how Coppermine themes work.  Ideally it is best to change stuff like this inside the theme, and the installation I'm working on already has several core changes.
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: Applying CSS only to table in Single Upload Form
« Reply #1 on: December 30, 2016, 05:46:48 pm »

Not able to give you the exact location as I am responding on a windows phone. What you would normally do is apply the required changes in theme.php. In the waterdrop theme this file only contains a few elements that override the default. So to add the block you need to change you copy the block you need from the sample theme as that contains everything.

This section of the docs explains this in more detail paying particular attention to the links in the what's next section  - http://documentation.coppermine-gallery.net/en/theme.htm#theme_engine

If you still need help hopefully one of the team or community can assist as I am away from home for the next few weeks.

Logged
It is a mistake to think you can solve any major problems just with potatoes.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Applying CSS only to table in Single Upload Form
« Reply #2 on: June 30, 2017, 04:15:13 pm »

Do you still need help with this?
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 19 queries.