JQuery Slider

Discussion forum for MOD Writers regarding MOD Development.
withend
Registered User
Posts: 12
Joined: Wed May 26, 2010 9:28 am

JQuery Slider

Post by withend »

Hello there, once again.

I have installed a phpbb3 portal in my site, and I've put a Jquery slider (with images and text) in the portal of my forum. The thing is that this is written on html, which means that the code, looks like this

Code: Select all

<div id="fragment-1"><img src="slide1.jpg"><p>"Text decription" etc...
And when I want to change the content, I have to edit the html file, and reupload it with FTP.

What I would like to do, is either make some variables, eg {Slider_Image1_URL},{Slider_Image1_Description}, etc, so that I will only have to edit these variables from my panel or sth. The thing is that I don't really know how to do this.

I would be very grateful, if you could help me with something.. Just to get a start.
User avatar
Saldash
Registered User
Posts: 619
Joined: Mon Nov 10, 2008 8:08 am
Location: Flintshire, UK
Name: Stuart Jackson
Contact:

Re: JQuery Slider

Post by Saldash »

Try adding this to the the php page running your portal.

Code: Select all

$template->assign_vars(array(
'L_IMAGE1_URL'			=> 'http://www.domain.com/path/to/img.png',
'L_IMAGE1_DESC'			=> 'Text for description',
));

You should find that the first line already exists, just search for it and add the variables as shown above.
The tags for the above would look like: {L_IMAGE1_URL} and {L_IMAGE1_DESC}

If you want to take it further than that, you could create an ACP module to control either a set number of variables, or even go better than that and have one that controls a potentially limitless table of information.
World Recoded UK - DreamHost Site of the Month winner February 2011!
withend
Registered User
Posts: 12
Joined: Wed May 26, 2010 9:28 am

Re: JQuery Slider

Post by withend »

Is there a way to change, for example, the link for an image, without having to access my file servers through ftp? If I wanted to make a module, what would the code be, so as to set for example {L_IMAGE1_URL} to another url than previously?

So basically some code, that will parse the textbox that includes the new link, and transfer it to portal.php.

Thank you so much for your help, by the way. :)
User avatar
Saldash
Registered User
Posts: 619
Joined: Mon Nov 10, 2008 8:08 am
Location: Flintshire, UK
Name: Stuart Jackson
Contact:

Re: JQuery Slider

Post by Saldash »

Depending on how familiar you are with the ACP and it's inner workings, you could add input boxes to and existing ACP module, or create an entirely new sub-module (page).

To simply add the input boxes, open /includes/acp/acp_board.php
Find:

Code: Select all

'legend4'				=> 'ACP_SUBMIT_CHANGES',
On a new line before that, add:

Code: Select all

'legend3'				=> 'JQS_SETTINGS',
'JQS_IMG1_URL'		=> array('lang' => 'JQS_IMG1_URL',		'validate' => 'string',	'type' => 'textarea:5:40', 'explain' => false),
'JQS_IMG1_DES'		=> array('lang' => 'JQS_IMG1_DES',		'validate' => 'string',	'type' => 'textarea:5:40', 'explain' => false),
Save and close the file.

Open /language/en/acp/board.php
Find:

Code: Select all

'BOARD_PM_EXPLAIN'			=> 'Enable or disable private messaging for all users.',
On a new line after that, add:

Code: Select all

'JQS_IMG1_URL'               => 'Image 1 URL',
'JQS_IMG1_DES'               => 'Image 1 Description',
Save and close the file.

Open /language/en/acp/common.php
Find:

Code: Select all

'ACP_ADMINISTRATORS'		=> 'Administrators',
On a new line after that, add:

Code: Select all

'JQS_SETTINGS'		=> 'JQuery Slider Settings',
Save and close the file.

Open /includes/functions.php
Find:

Code: Select all

'SITENAME'		=> $config['sitename'],
On a new line before that, add:

Code: Select all

'JQS_IMG1_URL'		=> $config['JQS_IMG1_URL'],
'JQS_IMG1_DES'		=> $config['JQS_IMG1_DES'],
Save and close the file.

Open your portal template file
Add {JQS_IMG1_URL} where you want the URL to your image to appear.
Add {JQS_IMG1_DES} where you want the description of that image to appear.
Save and close the file.

Upload the edited files and enter your Admin Control Panel.
Use the clear cache function to clear the webserver cache of your existing template files.
In the "General" tab, navigate to the "Board Features" link and open.
Scroll down and you should see your newly added options in their own box.

Enter the data you want, and submit the changes.
Navigate back to where you placed the template tags, the information you placed should now replace the tags.
World Recoded UK - DreamHost Site of the Month winner February 2011!
withend
Registered User
Posts: 12
Joined: Wed May 26, 2010 9:28 am

Re: JQuery Slider

Post by withend »

Thank you soooo much! :D Your help was really precious! :D
Everything works like a charm! :D :D Don't know what else to sayy! You're the best! ;)
User avatar
Saldash
Registered User
Posts: 619
Joined: Mon Nov 10, 2008 8:08 am
Location: Flintshire, UK
Name: Stuart Jackson
Contact:

Re: JQuery Slider

Post by Saldash »

Just glad I could help :mrgreen:
World Recoded UK - DreamHost Site of the Month winner February 2011!
bozo0983
Registered User
Posts: 13
Joined: Wed Apr 18, 2012 11:40 am

Re: JQuery Slider

Post by bozo0983 »

Firstly sorry for dragging an old topic out of bed but was hoping you could help.

I have also installed a jquery slider/carousel and images are called in the current fashion:

Code: Select all

 <li>
<a href="#">
<img src="01.jpg" width="75" height="75" alt=""  />
</a></li>
What I would like to happen is:

Code: Select all

<li>
<a href="{IMAGE_LINK_1">
<img src="IMAGE_URL_1" width="75" height="75" alt=""  />
</a></li>
and then be able to change the link and image url through the acp.

Is this possible? I made the edits mentioned above and it didn't work, perhaps because it's an older version than what I am now running?! I'm running 3.0.10.

I should also point out that I'm adding this slider to the front page of my forum NOT the portal.

This is the error I recieved:

Code: Select all

Warning: Cannot modify header information - headers already sent by (output started at /home/punkishd/public_html/phpbb/language/en/acp/common.php:1) in /home/punkishd/public_html/phpbb/includes/functions.php on line 4668

Warning: Cannot modify header information - headers already sent by (output started at /home/punkishd/public_html/phpbb/language/en/acp/common.php:1) in /home/punkishd/public_html/phpbb/includes/functions.php on line 4670

Warning: Cannot modify header information - headers already sent by (output started at /home/punkishd/public_html/phpbb/language/en/acp/common.php:1) in /home/punkishd/public_html/phpbb/includes/functions.php on line 4671

Warning: Cannot modify header information - headers already sent by (output started at /home/punkishd/public_html/phpbb/language/en/acp/common.php:1) in /home/punkishd/public_html/phpbb/includes/functions.php on line 4672
Any help would be gratefully received.

Bozo
User avatar
Saldash
Registered User
Posts: 619
Joined: Mon Nov 10, 2008 8:08 am
Location: Flintshire, UK
Name: Stuart Jackson
Contact:

Re: JQuery Slider

Post by Saldash »

Recheck your PHP source, make sure there are no gaps at the beginning or end of your file
I.E. Before <?php or after ?>
World Recoded UK - DreamHost Site of the Month winner February 2011!
bozo0983
Registered User
Posts: 13
Joined: Wed Apr 18, 2012 11:40 am

Re: JQuery Slider

Post by bozo0983 »

Hey, thanks for your quick response.

I've just gone through and checked all the files I've edited and none of them have gaps, yet I am receiving the error message still.

One thing I did notice when I first edited the files was in acp_board.php

'legend4' => 'ACP_SUBMIT_CHANGES',

Already had a 'legend3' above it, I guess controlling a different mod, would that make a difference?!

Thanks again for your help.
User avatar
Saldash
Registered User
Posts: 619
Joined: Mon Nov 10, 2008 8:08 am
Location: Flintshire, UK
Name: Stuart Jackson
Contact:

Re: JQuery Slider

Post by Saldash »

The only other thing I can really suggest is going over step by step the changes you
made and seeing if you can spot anything.

What editor are you using as well by the way?
World Recoded UK - DreamHost Site of the Month winner February 2011!
bozo0983
Registered User
Posts: 13
Joined: Wed Apr 18, 2012 11:40 am

Re: JQuery Slider

Post by bozo0983 »

I've probably mucked something up somewhere, get the files from my back up and make fresh edits.

I done the edits on notepad first time round, I know there can be issues with this tho. (I've edited css files before and the structure has been completely mucked up!) so this time I think I'll make the edits in dreamweaver.

Thanks, I'll let you know how I get on!
User avatar
Saldash
Registered User
Posts: 619
Joined: Mon Nov 10, 2008 8:08 am
Location: Flintshire, UK
Name: Stuart Jackson
Contact:

Re: JQuery Slider

Post by Saldash »

I'd avoid using dreamweaver also..
Here's a list of tools that work well though:
Tools for development
World Recoded UK - DreamHost Site of the Month winner February 2011!
bozo0983
Registered User
Posts: 13
Joined: Wed Apr 18, 2012 11:40 am

Re: JQuery Slider

Post by bozo0983 »

OK, so this time I made the edits in notepad++, uploaded the files and no errors appeared, so I'm blaming notepad for the earlier mistakes!

So although I'm not getting the errors now, I'm also not getting the options to change {JQS_IMG1_URL} and {JQS_IMG1_LINK} in acp -> General -> Board Features.

Any ideas? Or should I just give up?

Thanks for your help thus far though.
User avatar
Saldash
Registered User
Posts: 619
Joined: Mon Nov 10, 2008 8:08 am
Location: Flintshire, UK
Name: Stuart Jackson
Contact:

Re: JQuery Slider

Post by Saldash »

Certainly don't give up, there's great satisfaction in completing a challenging task ;)
Can you post your PHP edits from /includes/acp/acp_board.php please?
World Recoded UK - DreamHost Site of the Month winner February 2011!
bozo0983
Registered User
Posts: 13
Joined: Wed Apr 18, 2012 11:40 am

Re: JQuery Slider

Post by bozo0983 »

There certainly is great pleasure in it. I'm only doing the edit to make my life easier later, but it's making my life hard now! Lol!

The edits I made were:

Code: Select all

'legend3'            => 'JQS_SETTINGS',
    'JQS_IMG1_URL'      => array('lang' => 'JQS_IMG1_URL',      'validate' => 'string',   'type' => 'textarea:5:40', 'explain' => false),
    'JQS_IMG1_LINK'      => array('lang' => 'JQS_IMG1_LINK',      'validate' => 'string',   'type' => 'textarea:5:40', 'explain' => false),
with the line previous to that and after that it looks like this:

Code: Select all

'legend3'			=> 'COPPA',
						'coppa_enable'		=> array('lang' => 'ENABLE_COPPA',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),
						'coppa_mail'		=> array('lang' => 'COPPA_MAIL',		'validate' => 'string',	'type' => 'textarea:5:40', 'explain' => true),
						'coppa_fax'			=> array('lang' => 'COPPA_FAX',			'validate' => 'string',	'type' => 'text:25:100', 'explain' => false),

					    'legend3'            => 'JQS_SETTINGS',
    'JQS_IMG1_URL'      => array('lang' => 'JQS_IMG1_URL',      'validate' => 'string',   'type' => 'textarea:5:40', 'explain' => false),
    'JQS_IMG1_LINK'      => array('lang' => 'JQS_IMG1_LINK',      'validate' => 'string',   'type' => 'textarea:5:40', 'explain' => false),

						'legend4'			=> 'ACP_SUBMIT_CHANGES',
Hope I didn't do something silly... :?
Locked

Return to “[3.0.x] MOD Writers Discussion”