Codoforum related discussions
Adding Lightbox2

http://sorgalla.com/lity/ instead of lightbox2. Because lightweight + responsive.

You have to download and upload lity and the newest version of Jquery.

lity.min.js **to** sites/default/assets/js/
new jquery.min.js **to** sites/default/assets/js/
lity.min.css **to** sites/default/assets/css/

Please don't forget to make backups of these files:

sys/Ext/Html.php
sites/default/assets/js/editor.js
sites/default/themes/default/templates/forum/topic.tpl
sites/default/themes/default/templates/user/profile/view.tpl
sites/default/themes/default/templates/layout.tpl

Open:

sys/Ext/Html.php

Change

68 'a' => array('href', 'target'),

To

68 'a' => array('href', 'target', 'data-lity'),

Save

Open:

sites/default/assets/js/editor.js

Change:

196 <img src="' + href + '" title="' + title + '" />
201 <img src="' + href + '" title="' + title + '" />
247 <a href="' + href + '"><img src="http://i.imgur.com/' + part[1] + '.jpg" title="' + title + '" /></a>
254 <img src="' + href + '" title="' + title + '" />

To:

196 <a href="' + href + '" data-lity="' + href + '" title="' + title + '"><img src="' + href + '" /></a>
201 <a href="' + href + '" data-lity="' + href + '" title="' + title + '"><img src="' + href + '" /></a>
247 <a href="' + href + '" data-lity="' + href + '" title="' + title + '"><img src="http://i.imgur.com/' + part[1] + '.jpg" /></a>
254 <a href="' + href + '" data-lity="' + href + '" title="' + title + '"><img src="' + href + '" /></a>

Save

Open:

sites/default/themes/default/templates/forum/topic.tpl

Find:

263 <link rel="stylesheet" type="text/css" href="{$smarty.const.DURI}assets/markitup/highlight/styles/github.css" />

Add before:

<script src="{$smarty.const.DURI}assets/js/lity.min.js"></script>
<link rel="stylesheet" type="text/css" href="{$smarty.const.DURI}assets/css/lity.min.css" />

Save

Open:

sites/default/themes/default/templates/user/profile/view.tpl

Find:

221 </script>

Add after:

<script src="{$smarty.const.DURI}assets/js/lity.min.js"></script>
<link rel="stylesheet" type="text/css" href="{$smarty.const.DURI}assets/css/lity.min.css" />

Save

Open

sites/default/themes/default/templates/layout.tpl

Find:

151  {$page.head.js}

Add after:

<script type="text/javascript" src="{$smarty.const.DURI}assets/js/jquery-1.11.3.min"></script>

Save

http://sorgalla.com/lity/ instead of lightbox2. Because lightweight + responsive. You have to download and upload lity and the newest version of Jquery. ```` lity.min.js **to** sites/default/assets/js/ new jquery.min.js **to** sites/default/assets/js/ lity.min.css **to** sites/default/assets/css/ ```` Please don&#039;t forget to make backups of these files: ```` sys/Ext/Html.php sites/default/assets/js/editor.js sites/default/themes/default/templates/forum/topic.tpl sites/default/themes/default/templates/user/profile/view.tpl sites/default/themes/default/templates/layout.tpl ```` Open: ```` sys/Ext/Html.php ```` Change ```` 68 &#039;a&#039; =&amp;gt; array(&#039;href&#039;, &#039;target&#039;), ```` To ```` 68 &#039;a&#039; =&amp;gt; array(&#039;href&#039;, &#039;target&#039;, &#039;data-lity&#039;), ```` Save Open: ```` sites/default/assets/js/editor.js ```` Change: ```` 196 &amp;lt;img src=&quot;&#039; + href + &#039;&quot; title=&quot;&#039; + title + &#039;&quot; /&amp;gt; 201 &amp;lt;img src=&quot;&#039; + href + &#039;&quot; title=&quot;&#039; + title + &#039;&quot; /&amp;gt; 247 &amp;lt;a href=&quot;&#039; + href + &#039;&quot;&amp;gt;&amp;lt;img src=&quot;http://i.imgur.com/&#039; + part[1] + &#039;.jpg&quot; title=&quot;&#039; + title + &#039;&quot; /&amp;gt;&amp;lt;/a&amp;gt; 254 &amp;lt;img src=&quot;&#039; + href + &#039;&quot; title=&quot;&#039; + title + &#039;&quot; /&amp;gt; ```` To: ```` 196 &amp;lt;a href=&quot;&#039; + href + &#039;&quot; data-lity=&quot;&#039; + href + &#039;&quot; title=&quot;&#039; + title + &#039;&quot;&amp;gt;&amp;lt;img src=&quot;&#039; + href + &#039;&quot; /&amp;gt;&amp;lt;/a&amp;gt; 201 &amp;lt;a href=&quot;&#039; + href + &#039;&quot; data-lity=&quot;&#039; + href + &#039;&quot; title=&quot;&#039; + title + &#039;&quot;&amp;gt;&amp;lt;img src=&quot;&#039; + href + &#039;&quot; /&amp;gt;&amp;lt;/a&amp;gt; 247 &amp;lt;a href=&quot;&#039; + href + &#039;&quot; data-lity=&quot;&#039; + href + &#039;&quot; title=&quot;&#039; + title + &#039;&quot;&amp;gt;&amp;lt;img src=&quot;http://i.imgur.com/&#039; + part[1] + &#039;.jpg&quot; /&amp;gt;&amp;lt;/a&amp;gt; 254 &amp;lt;a href=&quot;&#039; + href + &#039;&quot; data-lity=&quot;&#039; + href + &#039;&quot; title=&quot;&#039; + title + &#039;&quot;&amp;gt;&amp;lt;img src=&quot;&#039; + href + &#039;&quot; /&amp;gt;&amp;lt;/a&amp;gt; ```` Save Open: ```` sites/default/themes/default/templates/forum/topic.tpl ```` Find: ```` 263 &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;{$smarty.const.DURI}assets/markitup/highlight/styles/github.css&quot; /&amp;gt; ```` Add before: ```` &amp;lt;script src=&quot;{$smarty.const.DURI}assets/js/lity.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;{$smarty.const.DURI}assets/css/lity.min.css&quot; /&amp;gt; ```` Save Open: ```` sites/default/themes/default/templates/user/profile/view.tpl ```` Find: ```` 221 &amp;lt;/script&amp;gt; ```` Add after: ```` &amp;lt;script src=&quot;{$smarty.const.DURI}assets/js/lity.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;{$smarty.const.DURI}assets/css/lity.min.css&quot; /&amp;gt; ```` Save Open ```` sites/default/themes/default/templates/layout.tpl ```` Find: ```` 151 {$page.head.js} ```` Add after: ```` &amp;lt;script type=&quot;text/javascript&quot; src=&quot;{$smarty.const.DURI}assets/js/jquery-1.11.3.min&quot;&amp;gt;&amp;lt;/script&amp;gt; ```` Save
edited Dec 24 '15 at 8:57 am

They are the core files , they dont contain anything which the user will see.

What are you trying to do ?

They are the core files , they dont contain anything which the user will see. What are you trying to do ?

Hi adesh1414127033.

I want to use Lightbox2. A jquery thumbnail viewer. You click on the resized image and it gets bigger in a modal popup.
https://github.com/lokesh/lightbox2/

But for this I need to change the stucture of the image html code for BBcode and markdown.
This is the html for the image BBCode.

<img src="\1" alt="\1" />

To use Lightbox2 I have to change it to.

<a href="\1" data-lightbox="\1"><img src="\1" alt="\1" /></a>

And the same I must do with markdown.

Hi adesh1414127033. I want to use Lightbox2. A jquery thumbnail viewer. You click on the resized image and it gets bigger in a modal popup. https://github.com/lokesh/lightbox2/ But for this I need to change the stucture of the image html code for BBcode and markdown. This is the html for the image BBCode. ```` &amp;lt;img src=&quot;\1&quot; alt=&quot;\1&quot; /&amp;gt; ```` To use Lightbox2 I have to change it to. ```` &amp;lt;a href=&quot;\1&quot; data-lightbox=&quot;\1&quot;&amp;gt;&amp;lt;img src=&quot;\1&quot; alt=&quot;\1&quot; /&amp;gt;&amp;lt;/a&amp;gt; ```` And the same I must do with markdown.
edited Dec 20 '15 at 7:13 pm

You will find the img output code in

sites/default/assets/js.editor.js

around line 195

You will find the img output code in ``` sites/default/assets/js.editor.js ``` around line 195

I'm interested to know how it goes please, as I want to implement this or something similar smile

I&#039;m interested to know how it goes please, as I want to implement this or something similar ;)
edited Dec 21 '15 at 10:19 pm

@adesh1414127033

Inside the editor (live preview) it works perfect and the html code is correct:

<a href="imagelink" data-lightbox="imagelink" title="imagelink"><img src="imagelink"></a>

But inside the topic, the code is different:

<a href="imagelink" title="image hoster" rel="nofollow"><img src="imagelink"></a>

So Codoforum transforms my custom image link to an standard url link.

@adesh1414127033 Inside the editor (live preview) it works perfect and the html code is correct: ```` &amp;lt;a href=&quot;imagelink&quot; data-lightbox=&quot;imagelink&quot; title=&quot;imagelink&quot;&amp;gt;&amp;lt;img src=&quot;imagelink&quot;&amp;gt;&amp;lt;/a&amp;gt; ```` But inside the topic, the code is different: ```` &amp;lt;a href=&quot;imagelink&quot; title=&quot;image hoster&quot; rel=&quot;nofollow&quot;&amp;gt;&amp;lt;img src=&quot;imagelink&quot;&amp;gt;&amp;lt;/a&amp;gt; ```` So Codoforum transforms my custom image link to an standard url link.
edited Dec 22 '15 at 11:47 am

Yes, codoforum strips out all html attributes that are not in whitelist.

Open sys/Ext/Html.php, you will find $whitelist array, you need to add the attribute 'data-lightbox'

        'img' => array('src',
            'alt', 'title',
        ),

For now, only src, alt and title are whitelisted.

Yes, codoforum strips out all html attributes that are not in whitelist. Open sys/Ext/Html.php, you will find $whitelist array, you need to add the attribute &#039;data-lightbox&#039; ``` &#039;img&#039; =&amp;gt; array(&#039;src&#039;, &#039;alt&#039;, &#039;title&#039;, ), ``` For now, only src, alt and title are whitelisted.

Yes yes yes. smile It works.

@RolluS I changed my mind and use now http://sorgalla.com/lity/ instead of lightbox2. Because lightweight + responsive.

You have to download and upload lity and the newest version of Jquery.

lity.min.js **to** sites/default/assets/js/
new jquery.min.js **to** sites/default/assets/js/
lity.min.css **to** sites/default/assets/css/

Please don't forget to make backups of these files:

sys/Ext/Html.php
sites/default/assets/js/editor.js
sites/default/themes/default/templates/forum/topic.tpl
sites/default/themes/default/templates/user/profile/view.tpl
sites/default/themes/default/templates/layout.tpl

Open:

sys/Ext/Html.php

Change

68 'a' => array('href', 'target'),

To

68 'a' => array('href', 'target', 'data-lity'),

Save

Open:

sites/default/assets/js/editor.js

Change:

196 <img src="' + href + '" title="' + title + '" />
201 <img src="' + href + '" title="' + title + '" />
247 <a href="' + href + '"><img src="http://i.imgur.com/' + part[1] + '.jpg" title="' + title + '" /></a>
254 <img src="' + href + '" title="' + title + '" />

To:

196 <a href="' + href + '" data-lity="' + href + '" title="' + title + '"><img src="' + href + '" /></a>
201 <a href="' + href + '" data-lity="' + href + '" title="' + title + '"><img src="' + href + '" /></a>
247 <a href="' + href + '" data-lity="' + href + '" title="' + title + '"><img src="http://i.imgur.com/' + part[1] + '.jpg" /></a>
254 <a href="' + href + '" data-lity="' + href + '" title="' + title + '"><img src="' + href + '" /></a>

Save

Open:

sites/default/themes/default/templates/forum/topic.tpl

Find:

263 <link rel="stylesheet" type="text/css" href="{$smarty.const.DURI}assets/markitup/highlight/styles/github.css" />

Add before:

<script src="{$smarty.const.DURI}assets/js/lity.min.js"></script>
<link rel="stylesheet" type="text/css" href="{$smarty.const.DURI}assets/css/lity.min.css" />

Save

Open:

sites/default/themes/default/templates/user/profile/view.tpl

Find:

221 </script>

Add after:

<script src="{$smarty.const.DURI}assets/js/lity.min.js"></script>
<link rel="stylesheet" type="text/css" href="{$smarty.const.DURI}assets/css/lity.min.css" />

Save

Open

sites/default/themes/default/templates/layout.tpl

Find:

151  {$page.head.js}

Add after:

<script type="text/javascript" src="{$smarty.const.DURI}assets/js/jquery-1.11.3.min"></script>

Save

So @adesh1414127033 is it possible to use codoforums jquery.min for this instead of add another jquery source inside the layout.tpl and have this global active?

Yes yes yes. :D It works. @RolluS I changed my mind and use now http://sorgalla.com/lity/ instead of lightbox2. Because lightweight + responsive. You have to download and upload lity and the newest version of Jquery. ```` lity.min.js **to** sites/default/assets/js/ new jquery.min.js **to** sites/default/assets/js/ lity.min.css **to** sites/default/assets/css/ ```` Please don&#039;t forget to make backups of these files: ```` sys/Ext/Html.php sites/default/assets/js/editor.js sites/default/themes/default/templates/forum/topic.tpl sites/default/themes/default/templates/user/profile/view.tpl sites/default/themes/default/templates/layout.tpl ```` Open: ```` sys/Ext/Html.php ```` Change ```` 68 &#039;a&#039; =&amp;gt; array(&#039;href&#039;, &#039;target&#039;), ```` To ```` 68 &#039;a&#039; =&amp;gt; array(&#039;href&#039;, &#039;target&#039;, &#039;data-lity&#039;), ```` Save Open: ```` sites/default/assets/js/editor.js ```` Change: ```` 196 &amp;lt;img src=&quot;&#039; + href + &#039;&quot; title=&quot;&#039; + title + &#039;&quot; /&amp;gt; 201 &amp;lt;img src=&quot;&#039; + href + &#039;&quot; title=&quot;&#039; + title + &#039;&quot; /&amp;gt; 247 &amp;lt;a href=&quot;&#039; + href + &#039;&quot;&amp;gt;&amp;lt;img src=&quot;http://i.imgur.com/&#039; + part[1] + &#039;.jpg&quot; title=&quot;&#039; + title + &#039;&quot; /&amp;gt;&amp;lt;/a&amp;gt; 254 &amp;lt;img src=&quot;&#039; + href + &#039;&quot; title=&quot;&#039; + title + &#039;&quot; /&amp;gt; ```` To: ```` 196 &amp;lt;a href=&quot;&#039; + href + &#039;&quot; data-lity=&quot;&#039; + href + &#039;&quot; title=&quot;&#039; + title + &#039;&quot;&amp;gt;&amp;lt;img src=&quot;&#039; + href + &#039;&quot; /&amp;gt;&amp;lt;/a&amp;gt; 201 &amp;lt;a href=&quot;&#039; + href + &#039;&quot; data-lity=&quot;&#039; + href + &#039;&quot; title=&quot;&#039; + title + &#039;&quot;&amp;gt;&amp;lt;img src=&quot;&#039; + href + &#039;&quot; /&amp;gt;&amp;lt;/a&amp;gt; 247 &amp;lt;a href=&quot;&#039; + href + &#039;&quot; data-lity=&quot;&#039; + href + &#039;&quot; title=&quot;&#039; + title + &#039;&quot;&amp;gt;&amp;lt;img src=&quot;http://i.imgur.com/&#039; + part[1] + &#039;.jpg&quot; /&amp;gt;&amp;lt;/a&amp;gt; 254 &amp;lt;a href=&quot;&#039; + href + &#039;&quot; data-lity=&quot;&#039; + href + &#039;&quot; title=&quot;&#039; + title + &#039;&quot;&amp;gt;&amp;lt;img src=&quot;&#039; + href + &#039;&quot; /&amp;gt;&amp;lt;/a&amp;gt; ```` Save Open: ```` sites/default/themes/default/templates/forum/topic.tpl ```` Find: ```` 263 &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;{$smarty.const.DURI}assets/markitup/highlight/styles/github.css&quot; /&amp;gt; ```` Add before: ```` &amp;lt;script src=&quot;{$smarty.const.DURI}assets/js/lity.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;{$smarty.const.DURI}assets/css/lity.min.css&quot; /&amp;gt; ```` Save Open: ```` sites/default/themes/default/templates/user/profile/view.tpl ```` Find: ```` 221 &amp;lt;/script&amp;gt; ```` Add after: ```` &amp;lt;script src=&quot;{$smarty.const.DURI}assets/js/lity.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;{$smarty.const.DURI}assets/css/lity.min.css&quot; /&amp;gt; ```` Save Open ```` sites/default/themes/default/templates/layout.tpl ```` Find: ```` 151 {$page.head.js} ```` Add after: ```` &amp;lt;script type=&quot;text/javascript&quot; src=&quot;{$smarty.const.DURI}assets/js/jquery-1.11.3.min&quot;&amp;gt;&amp;lt;/script&amp;gt; ```` Save So @adesh1414127033 is it possible to use codoforums jquery.min for this instead of add another jquery source inside the layout.tpl and have this global active?
edited Dec 24 '15 at 12:15 pm

Yes, it is possible.

Instead of adding script/link tags in the tpl files.

Add your scripts in the theme.php file present in the
sites/default/themes/blue directory

Not sites/default/themes/default/

You will find a method ->addJS() there

The first parameter is url to js file but, you by default
{$smarty.const.DURI}assets/js/ is already prepended, so you don't have to write the full path.

Yes, it is possible. Instead of adding script/link tags in the tpl files. Add your scripts in the theme.php file present in the `sites/default/themes/blue` directory **Not `sites/default/themes/default/`** You will find a method -&amp;gt;addJS() there The first parameter is url to js file but, you by default `{$smarty.const.DURI}assets/js/` is already prepended, so you don&#039;t have to write the full path.

Yes yes yes. smile It works.

@RolluS I changed my mind and use now http://sorgalla.com/lity/ instead of lightbox2. Because lightweight + responsive.

You have to download and upload lity and the newest version of Jquery.

Awsome thank you, that's working smile

I'm going to modify this to work with forum hosted pics.

Also, generating thumbnails with Imagemagick would be awsome!

I may try HiSlide.JS which, if I understood documentation correctly, can handle resizing.

&amp;gt;Yes yes yes. :D It works. &amp;gt;@RolluS I changed my mind and use now http://sorgalla.com/lity/ instead of lightbox2. Because lightweight + responsive. &amp;gt;You have to download and upload lity and the newest version of Jquery. Awsome thank you, that&#039;s working :D I&#039;m going to modify this to work with forum hosted pics. Also, generating thumbnails with Imagemagick would be awsome! I may try [HiSlide.JS](http://highslide.com/#examples) which, if I understood documentation correctly, can handle resizing.
edited Jan 7 '16 at 1:17 pm
350
11
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft