Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 04-02-2015, 12:53 AM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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 ?
Reply With Quote
  #2  
Old 04-02-2015, 01:24 AM
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
Posts: 6,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

vb is php based so the source will show it that way but as to your question you have not asked one
Reply With Quote
  #3  
Old 04-02-2015, 01:35 AM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ForceHSS View Post
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 ?
Reply With Quote
  #4  
Old 04-02-2015, 03:24 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 04-02-2015, 05:42 AM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarkFL View Post
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>
Reply With Quote
  #6  
Old 04-02-2015, 06:03 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 04-02-2015, 08:53 AM
blind-eddie's Avatar
blind-eddie blind-eddie is offline
 
Join Date: Apr 2006
Location: Michigan
Posts: 2,310
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 04-02-2015, 09:19 AM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by blind-eddie View Post
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:



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>
Reply With Quote
  #9  
Old 04-02-2015, 02:58 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Благодарность от:
RichieBoy67
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:26 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.22995 seconds
  • Memory Usage 2,267KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (4)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (1)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete