Trouble with Insert/Edit Link

8 posts by 2 authors in: Forums > CMS Builder
Last Post: March 7, 2008   (RSS)

By avrom - March 7, 2008

Hello,

Sorry to bug again. When I set up a link with the "Insert/Edit Link" button it keeps changing the link to the cmsAdmin/ directory.

For example when I set the link to "page.php" it keeps resetting it to "cmsAdmin/page.php". Even if I use the Code button and change the html it still sets it back.

I assume there is a little config setting for this somewhere ?

Thanks so much,
Avrom

Re: [virgodesign] Trouble with Insert/Edit Link

By Dave - March 7, 2008

It's because "page.html" is a relative link. Your viewers might be in any directory so it tries to make it into an absolute link.

Is it possible to create links starting with / or http://?

There may be a setting for this that would always make it link off the root. So page.html would become /page.html

Let me know what you want to do for that.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Trouble with Insert/Edit Link

By avrom - March 7, 2008

Hi Dave,

I would like to have the option of either an absolute link (http://www.somelink.com) or a relative link to the root directory only of the website (/page.html).

Thanks kindly,

Avrom

Re: [virgodesign] Trouble with Insert/Edit Link

By Dave - March 7, 2008

Ok, right now you should be able to enter "/page.html" or "http://www.example.com/page.html" and have it work correctly. If it doesn't let me know.

I've added some code to the wysiwyg for the next version so when you enter "page.html" it will convert it to be absolute from the root "/page.html".

I've had questions about that before so hopefully that will be a better solution than what it was doing before.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Trouble with Insert/Edit Link

By avrom - March 7, 2008

Cheers Dave,

That works fine. Thank you. Hey if you have the code and you want to share, that would be awesome.

Btw,
Regarding the CMS, I figured the way you might want to display the "menu" items instead of along the menu top-bar is to display them just like you do for the Admin Section Editors.

Admin > Section Editors (that page)

I assume that would be quite easy to do from a coding view as its already setup that way in the program. If it is I would be really interested in the coding for that.

As always thank you for all your help :)

Avrom

Re: [virgodesign] Trouble with Insert/Edit Link

By Dave - March 7, 2008

No problem. To have relative links auto converted to absolute urls from the website root just open /lib/menus/default/edit_functions.php, search for "relative_urls" and replace that line with this:

relative_urls : false,
document_base_url: "/",


This change will be in v1.11 (the next release).

To display the menu list on the home page you could just copy some code from /lib/menus/header.php to /lib/menus/home.php. Try adding this to home.php:

<?php
require_once "lib/menus/header_functions.php";

foreach (getMenuList() as $row) {
$hasMenuAccess = @$CURRENT_USER['accessList']['all']['accessLevel'] >= 6 ||
@$CURRENT_USER['accessList'][@$row['tableName']]['accessLevel'] >= 6;
if (!$hasMenuAccess) { continue; }

print "<a href='?menu={$row['tableName']}'>" . htmlspecialchars($row['menuName']) ."</a><br/>\n";
}
?>


Let me know if that does what you need.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Trouble with Insert/Edit Link

By avrom - March 7, 2008

Cheers Dude,

Is there some table and row settings that need to be defined ? since I just get a blank result for that coding...

i.e.example (not sure on actual values)

$options = array();
$options['tableName'] = $current;
$options['recordNum'] = '';
$options['where'] = '';
$record = getRecord($options);

Re: [virgodesign] Trouble with Insert/Edit Link

By Dave - March 7, 2008

Where did you want it displayed? I was thinking you wanted it on the homepage you see when you login to CMS Builder. That's the page that says "Welcome to CMS Builder v1.xx". If you add the code to that file (in /lib/menus/home.php) it should work.

Did you want it displayed there or somewhere else?
Dave Edis - Senior Developer
interactivetools.com