vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   how to do this (https://vborg.vbsupport.ru/showthread.php?t=318088)

Easy5s.net 04-02-2015 12:53 AM

how to do this
 
When I post like:

[img ]http://domain.com/picture.jpg[/img]
description...

and when I want view source, it looks like this:

Code:

<a href="http://domain.com/picture.jpg">
        <img src="http://domain.com/picture.jpg" />
</a>
<div class="des">description...</div>

How to auto add tag <div class="des"> for description... and <a href=" for img ?

ForceHSS 04-02-2015 01:24 AM

vb is php based so the source will show it that way but as to your question you have not asked one

Easy5s.net 04-02-2015 01:35 AM

Quote:

Originally Posted by ForceHSS (Post 2542138)
vb is php based so the source will show it that way but as to your question you have not asked one

How to auto add tag <div class="des"> for description... and <a href=" for img ?

MarkFL 04-02-2015 03:24 AM

I am thinking you will need to hack the file "/includes/class_bbcode.php" to include this extra HTML, if I am interpreting your question correctly.

Open that file, and locate the text:
PHP Code:

// Display the attachment with no link to bigger image 

Beneath this you will see the code:
PHP Code:

                                $replace[] = ($fullsize '<div class="size_fullsize">' '') .
                                    
"<img class=\"image\" src=\"{$this->registry->options['bburl']}/attachment.php?{$this->registry->session->vars['sessionurl']}attachmentid=\\1&amp;d=$attachment[dateline]$stc\" border=\"0\" alt=\""
                                
construct_phrase($vbphrase['image_x_y_z'], $attachment['filename'], $attachment['counter'], $attachment['filesize'])
                                . 
"\" " . ((!empty($align) AND $align != 'config') ? " style=\"float: $align\"" '') . " />"

Now it's just a matter of adding the HTML markup you want.

Easy5s.net 04-02-2015 05:42 AM

Quote:

Originally Posted by MarkFL (Post 2542141)
I am thinking you will need to hack the file "/includes/class_bbcode.php" to include this extra HTML, if I am interpreting your question correctly.

Open that file, and locate the text:
PHP Code:

// Display the attachment with no link to bigger image 

Beneath this you will see the code:
PHP Code:

                                $replace[] = ($fullsize '<div class="size_fullsize">' '') .
                                    
"<img class=\"image\" src=\"{$this->registry->options['bburl']}/attachment.php?{$this->registry->session->vars['sessionurl']}attachmentid=\\1&amp;d=$attachment[dateline]$stc\" border=\"0\" alt=\""
                                
construct_phrase($vbphrase['image_x_y_z'], $attachment['filename'], $attachment['counter'], $attachment['filesize'])
                                . 
"\" " . ((!empty($align) AND $align != 'config') ? " style=\"float: $align\"" '') . " />"

Now it's just a matter of adding the HTML markup you want.

NO.

I just wanted to post my img, after finishing post I want the code to be like this:

Code:

<a href="http://domain.com/picture.jpg"><img src="http://domain.com/picture.jpg" /></a>
<div class="des">description...</div>


MarkFL 04-02-2015 06:03 AM

And I was explaining one possible way to do just that. You could also do it client-side using javascript, but what I suggested would be easier I think.

blind-eddie 04-02-2015 08:53 AM

When you create a new thread/post, you add a linked image to it right?
You are wanting to know how to show tags in the source code for said linked image?

Well, you can't that I am aware of unless what MarkFL posted works that way.

You can however allow html while posting and use what you showed in your first post to achieve what you are after but, that is a very risking to allow.

Easy5s.net 04-02-2015 09:19 AM

Quote:

Originally Posted by blind-eddie (Post 2542149)
When you create a new thread/post, you add a linked image to it right?
You are wanting to know how to show tags in the source code for said linked image?

Well, you can't that I am aware of unless what MarkFL posted works that way.

You can however allow html while posting and use what you showed in your first post to achieve what you are after but, that is a very risking to allow.

You are wanting to know how to show tags in the source code for said linked image?
YES

After I post have inserted pictures as usual -> OK, then I want when I view source (right click -> View Page Source). the html code will look something like this:

When post:
https://vborg.vbsupport.ru/external/2015/04/39.png


I want when I view source (right click -> View Page Source):
Code:

<a href="http://localhost/demov4/images/misc/vbulletin1_logo.png">
        <img src="http://localhost/demov4/images/misc/vbulletin1_logo.png" />
</a>
<div class="des">image 01</div>

<a href="http://localhost/demov4/images/misc/vbulletin2_logo.png">
        <img src="http://localhost/demov4/images/misc/vbulletin2_logo.png" />
</a>
<div class="des">image 02</div>

<a href="http://localhost/demov4/images/misc/vbulletin3_logo.png">
        <img src="http://localhost/demov4/images/misc/vbulletin3_logo.png" />
</a>
<div class="des">image 03</div>

<a href="http://localhost/demov4/images/misc/vbulletin4_logo.png">
        <img src="http://localhost/demov4/images/misc/vbulletin4_logo.png" />
</a>
<div class="des">image 04</div>


MarkFL 04-02-2015 02:58 PM

The HTML that is generated associated with images posted using the IMG tags is done in the file /includes/class_bbcode.php. In this file is a function called "handle_bbcode_img()."

You would also need to alter the PHP code to allow for the innerHTML of your div element to be passed as an option with the IMG tags, for example:

Code:

[IMG=image 04]http://localhost/demov4/images/misc/vbulletin4_logo.png[/IMG]
Another option would be to create a custom BBCode that will generate the HTML you desire.


All times are GMT. The time now is 12:31 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01167 seconds
  • Memory Usage 1,759KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (4)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete