News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

How to add tag Alt=" as forum title to images of the forum?

Started by bollywood123, September 24, 2008, 01:58:20 AM

Previous topic - Next topic

bollywood123

I'm wondering if its possible to add The topic title as Alt="" to the images in that topic under [img]?

Nathaniel

The edits below are for SMF 2 Beta and the 'Subs.php' file.

Find this code:
// Parse bulletin board code in a string, as well as smileys optionally.
function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = array())
{
    global $txt, $scripturl, $context, $modSettings, $user_info;
    static $bbc_codes = array(), $itemcodes = array(), $no_autolink_tags = array();
    static $disabled;


Replace with this code:
// Parse bulletin board code in a string, as well as smileys optionally.
function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = array())
{
    global $txt, $scripturl, $context, $modSettings, $user_info, $topicinfo;
    static $bbc_codes = array(), $itemcodes = array(), $no_autolink_tags = array();
    static $disabled;


Find this code:
            array(
                'tag' => 'img',
                'type' => 'unparsed_content',
                'parameters' => array(
                    'alt' => array('optional' => true),
                    'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(d+)'),
                    'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(d+)'),
                ),
                'content' => '<img src="$1" alt="{alt}"{width}{height} class="bbc_img" />',
                'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array('<br />' => ''));'),
                'disabled_content' => '($1)',
            ),
            array(
                'tag' => 'img',
                'type' => 'unparsed_content',
                'content' => '<img src="$1" alt="" class="bbc_img" />',
                'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array('<br />' => ''));'),
                'disabled_content' => '($1)',
            ),


Replace with this code:
            array(
                'tag' => 'img',
                'type' => 'unparsed_content',
                'parameters' => array(
                    'alt' => !empty($topicinfo['subject']) ? $topicinfo['subject'] : array('optional' => true),
                    'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(d+)'),
                    'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(d+)'),
                ),
                'content' => '<img src="$1" alt="{alt}"{width}{height} class="bbc_img" />',
                'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array('<br />' => ''));'),
                'disabled_content' => '($1)',
            ),
            array(
                'tag' => 'img',
                'type' => 'unparsed_content',
                'content' => '<img src="$1" alt="' . (!empty($topicinfo['subject']) ? $topicinfo['subject'] : '') . '" class="bbc_img" />',
                'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array('<br />' => ''));'),
                'disabled_content' => '($1)',
            ),
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Advertisement: