PDA

View Full Version : CMS Advice, adding links to text.


tux
10-23-2008, 11:50 AM
Hi all,

I have a website that I have built for my bro' who is a photographer. I have included a CMS so he can manage his images etc., but I would like to add a bit more function for him so he can also make changes to his home and about pages. I'm okay building the main function of this but if you check out the home page (http://photographybydantucker.com/index.php) he has links within his text. This is at present hard coded.

The advice I need is how to build function so he can add the links himself.

Hope this is clear, thanks.

Paul

gavimobile
10-23-2008, 12:02 PM
Hi all,

I have a website that I have built for my bro' who is a photographer. I have included a CMS so he can manage his images etc., but I would like to add a bit more function for him so he can also make changes to his home and about pages. I'm okay building the main function of this but if you check out the home page (http://photographybydantucker.com/index.php) he has links within his text. This is at present hard coded.

The advice I need is how to build function so he can add the links himself.

Hope this is clear, thanks.

Paul
heres an idea,
maybe create a database table with the following fields,
id, alias, link, title,

alias will = to the id number and it will be easier for him to pull the link.

or
if it will stay hardcoded, that just give him a sample of the link id/class so css can do its work. this way, he can write new text, and just make sure he does <a href="location.php" class="the given link class" >his link</a>

hope this was helpful

tux
10-23-2008, 05:56 PM
Thanks for that Gav, I'll give it some thought.

In the meantime has anyone else got any ideas of how this can be done.

Cheers all, regards,

Paul

edbr
10-24-2008, 01:40 AM
what about adding tinymice? this can give him the ability to create links

lux
10-24-2008, 08:15 AM
Include a javascript WYSIWYG editor

Using the tinymce (basic config) you can let your brother format text, links, images etc....

http://tinymce.moxiecode.com/

@edbr : same as what you suggested.

if you don't like this one there are loads of other WYSIWYG editors on the web


*WYSIWYG - What You See Is What You Get

tux
10-25-2008, 06:50 PM
Thanks for that guys but I was thinking of building the function myself in php.

I can build a simple CMS so that he could add and change his own text on the home page etc.. I just need pointing in the right direction as to how to allow him to add links into that text.

Cheers, Paul

edbr
10-27-2008, 02:21 AM
well its the same really , make a cms with an insert and update form when you link then to tiny mice ,which you upload to your sever it add features to format the text,add links etc etc. it only requires a line of code (link) on your pages

lux
10-27-2008, 10:46 AM
function hyperlink($string){

$string = preg_replace("/(http:\/\/)?([a-zA-Z0-9\-.]+\.[a-zA-Z0-9\-]+([\/]([a-zA-Z0-9_\/\-.?&%=+])*)*)/", '<a href="http://$2">$2</a>', $string);

return $string;

}

$string = "This is a link to http://www.google.com.";

$link = hyperlink($string);

echo $link;

tux
10-27-2008, 12:31 PM
This looks interesting LUX. Could you explain it for me.

How would I include this so that it can be used to define links in a paragraph of text.

ie. Please click 'here'. (making the word 'here' a link)

Thanks, Paul

lux
10-27-2008, 01:28 PM
so you pass the function the text (submitted by the user) the function uses php's preg_replace function to search a string, look for a matching pattern and replace the pattern with a specified string of characters.

php manual for more info on the function: php.net/preg_replace

if you ware to change the replacement text edit the string in the preg_replace function from:

'<a href="http://$2">$2</a>'

to

'<a href="http://$2">here</a>'

tux
10-27-2008, 01:30 PM
Thanks for that, I will give it a try.

Regards, Paul

tux
10-30-2008, 12:46 PM
Okay guys, I have downloaded TinyMCE and want to include it but I expected an exe file and some sort of software.

I cant make head nor tail of the files that I downloaded and cant seem to find any installation info on their site so....

How do you implement TinyMCE into your CMS???

Cheers guys,

Paul

lux
10-30-2008, 04:16 PM
Install guidelines: http://wiki.moxiecode.com/index.php/TinyMCE:Installation

Install refers to copying and pasting the files on your web server and pointing to the specified tinymce js file. Then adding the required code to the page with textarea to be effected.

edbr
10-31-2008, 01:06 AM
sample some (advanced version) path as needed
<!-- tinyMCE -->
<script language="javascript" type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
// Notice: The simple theme does not use all options some of them are limited to the advanced theme
tinyMCE.init({
mode : "textareas",
theme : "advanced"
});
</script>
<!-- /tinyMCE -->