Link to Page

Permalink 1 user found helpful
I'm having a bit of an elementary problem perhaps. I've done this a few times in my site but not since updating to 5.4.0 and now when I try to add a Link to a page within my sitemap - it only links to my home page. I added a new page that I want to link to from the parent page (I don't want it in the AutoNav) but when I click Link to Page and then click that page - the link takes me to the home page and not to the page I linked to. Any ideas why???

View Replies: View Best Answer
Shotster replied on at Permalink Reply
Shotster
Where exactly do you see the "Link to Page" option? I see no such thing in my site map.

-Steve
vebarnid replied on at Permalink Reply
It's not within the sitemap. When I add a content block there is an option at the top Insert Link to Page. When I try to insert a link to a page that is in my Sitemap - it doesn't link to the page I selected rather it is linking to my home page instead.
cursal replied on at Permalink Reply
cursal
I am having the same problem.

No idea why it's happening???

My thread:
http://www.concrete5.org/community/forums/customizing_c5/add-page-l...
cursal replied on at Permalink Reply
cursal
Has anybody else had this problem or are we 2 the only ones?

Any luck with figuring it out vebarnid?

Linking to other pages via the content block is a pretty important feature...

I am still looking
cursal replied on at Permalink Reply
cursal
Starting to get buggy about this now. I just built a whole new site on a fresh 5.4 install and I can't link to page from inside a "content" block.

Ughhhh....
mose replied on at Permalink Reply
mose
I can only confirm that "Insert Link to Page" inside a content block works here (Concrete 5.4.0).

Edit: Just to make sure I was testing the same thing as you, I excluded the page from AutoNav, and I was able to link to it. The link leads to that page.
cursal replied on at Permalink Reply
cursal
Thanks for your feedback.

On another site I just did an upgrade and the link to page works...

I am baffled as to what would cause this on this one site.

And seems I'm not alone.

Any clues where to look?
mose replied on at Permalink Reply
mose
You probably have to do some troubleshooting to track down the problem. Since page selection is driven by jQuery, it is possible that some JavaScript in the web page is messing up that process. Create a new test page, set it to some generic theme like the default vanilla theme, add a content block and try to link a page. If it works, that points to something being added in your theme or something being added by a block on the page (or in the header or footer) that is interfering with the selection of a page. Eliminate each item one by one until the problem disappears, and you will have found the cause.
cursal replied on at Permalink Reply
cursal
Thank you again Mose,

I created a new page in top and lower directories, set it to plain yogurt
only added a content block.

Nothing but suto-nav and content block on page with links.

Made a link to one page in sub directory
and one to a page in top directory.
exclude from nav checked.
!Test failed.

included in nav
!Test Failed

test failed on both top level and one level deep pages.

If you would like to take a look PM me.
cursal replied on at Permalink Reply
cursal
Update:

On above created test page even using external link icon to link to any page on site results in going to index.php

pasting in a real external link (outside of site) works.

So seems creating any link to any page using either method results in pointing to index.php
not just the Link to Page.
??

When creating a Link to Page, the Alt tag shows the page title on mouse over, but still point to, you guessed it, the index.php page

---adding---
only js running on test page:
<script type="text/javascript">
var CCM_DISPATCHER_FILENAME = '/lapdesk2/index.php';
var CCM_CID = 70;
var CCM_EDIT_MODE = false;
var CCM_ARRANGE_MODE = false;
var CCM_IMAGE_PATH = "/lapdesk2/concrete/images";
var CCM_TOOLS_PATH = "/lapdesk2/index.php/tools/required";
var CCM_REL = "/lapdesk2";
</script>
mose replied on at Permalink Reply
mose
It seems like something else might not be set correctly. Do you mind posting a link to your site or to a test page where we can look at the links being generated?
cursal replied on at Permalink Reply
cursal
sure :)

http://www.x1k.net/lapdesk2/

the link on the left 'test2' (at the bottom) is the test page with plain yogurt and only the content block.

Thank you for your continued support mose.
mose replied on at Permalink Reply
mose
OK, I have a couple of questions.

1. Do you have pretty URLs turned on?
2. If yes, do you have URL_REWRITING_ALL defined as true in config/site.php, and is the web server set to rewrite the URLs?
3. Is ldapdesk2 the home directory of the website?
4. If yes, is DIR_REL defined as lapdesk2 in config/site.php?
5. Is BASE_URL defined ashttp://www.xk1.net in config/site.php?
6. Any other variables defined that we should know about?
cursal replied on at Permalink Reply
cursal
1. Do you have pretty URLs turned on?
no

2. If yes, do you have URL_REWRITING_ALL defined as true in config/site.php, and is the web server set to rewrite the URLs?
n/a

3. Is ldapdesk2 the home directory of the website?
Yes, although many sites on this domain. Just created a directory and put c5 in there (5.4 clean install and built the whole site no problem)

4. If yes, is DIR_REL defined as lapdesk2 in config/site.php?
Yes. below from config file
define('DIR_REL', '/lapdesk2');


5. Is BASE_URL defined ashttp://www.xk1.net in config/site.php?
Yes. below from config file
define('BASE_URL','http://www.x1k.net');


6. Any other variables defined that we should know about?
none that i can think of.

I add custom templates in the blocks directory (not under concrete directory)
for Image, slideshow, and guestbook.

If you would like to IM let me know and I'll sign on
mose replied on at Permalink Reply
mose
Clear cache, both in c5 and files/cache. Then, access the web page.
cursal replied on at Permalink Reply
cursal
Done.

I tried adding a link from home page text in first line:
"The shredded" to the articles page.

still links back to index.php

there was a lots of files in that files/cache
all gone now, although the cache has been disabled from day one of this project

---added---
On the test2 page even when I use ctrl + v (paste) a full text link in the content block i.e

http://www.x1k.net/lapdesk2/index.php?cID=60...

it converts that PLAIN TEXT to /lapdesk2/index.php/

just text??? what's that about?
mose replied on at Permalink Reply
mose
Two possibilities come to mind.

1. You have not approved the pages to which you are linking.
2. Guest does not have access to view the pages to which you are linking.
cursal replied on at Permalink Reply
cursal
No permissions have been touched since install.

Registration is not enabled

created a page at parent level (under home) still adds working page link to autonav

all pages allow guests to view

Only admin can edit pages.

possible chomd issues somewhere?

Thanks for your help so far...any further suggestions?
mose replied on at Permalink Reply
mose
I'm starting to run out of ideas. If you edit the content block, link to a page and then switch to HTML, do you see the entire link? For example,

http://www.x1k.net/ldapdesk2/index.php?cID=60...
cursal replied on at Permalink Reply
cursal
Yes, it does.

here is the code in HTML that is seen when clicking the html in the content block

<p>&nbsp;</p>
<hr />
<p>&nbsp;</p>
<p>This link is added and then viewed with html</p>
<p>LINK TO <a title="Order Page" href="http://www.x1k.net/lapdesk2/index.php?cID=68">Order Page</a></p>


added a new content block to test2 under the hr tag
http://www.x1k.net/lapdesk2/index.php?cID=70...
cursal replied on at Permalink Reply
cursal
[ code ] above didn't come up right
below is what is there:

<p>&nbsp;</p>
<hr />
<p>&nbsp;</p>
<p>This link is added and then viewed with html</p>
<p>LINK TO <a title="Order Page" href="http://www.x1k.net/lapdesk2/index.php?cID=68">Order Page</a></p>
mose replied on at Permalink Reply
mose
I was looking through the previous messages for clues. In one message, question 5 asked for the value of BASE_URL. Your answer has an "href" in it. I don't know if that is an artifact from a copy/paste or if that is really in site.php. Is BASE_URL defined like below?

define('BASE_URL','http://www.x1k.net');
cursal replied on at Permalink Reply
cursal
just an artifact.
I'm going to stop using [ code] as it is throwing in artifacts.

define('BASE_URL', 'http://www.x1k.net');

is correct in site/config.php
mose replied on at Permalink Reply
mose
Do you have any add-ons besides what is included in a standard installation? Is this a single-site install (i.e., not a multi-site installation that shares one c5 code base)? Are you using the standard installation directories?
cursal replied on at Permalink Reply
cursal
Addons:
Galleria image gallery - 2.0 installed but not used
Zoom Image - 1.0.1 (in use)
Sisimizi's Download Folder - 1.0 installed but not used
AddThis - 1.0 installed but not used

Single site install, no sharing
everything is standard

I do call images from a custom image directory I added to the root, named 'images'
x1k.net/lapdesk2/images/
mose replied on at Permalink Reply
mose
What mode is the editor in? Basic, Word, Advanced, Custom?
cursal replied on at Permalink Reply
cursal
I use: Office and have tried Basic
mose replied on at Permalink Reply
mose
Go to a page you want to link to. Edit the page. Click Properties. Click the tab for "Page Paths and Location". What does it have in the box for the canonical URL?
cursal replied on at Permalink Reply
cursal
same as normal, it uses the alias.

For pages under Home i.e testimonials

shows:
http://www.x1k.net/lapdesk2index.php...
then in the box it says 'testimonials' (no slash and no quote)

It does the same for pages under child pages

home
|__articles
|proper-position

shows:
http://www.x1k.net/lapdesk2index.php...
then in the box it says 'proper-position' (no slash and no quote)

Original issue:
I was linking the article's page to a child page under it named and aliased 'proper-position' when I first noticed that the Link to page didn't work.
mose replied on at Permalink Reply
mose
These URLs don't work, and I think they should. Whatever is causing this problem is probably preventing the links from being translated correctly.

http://www.x1k.net/lapdesk2/index.php/testimonials/...
http://www.x1k.net/lapdesk2/index.php/proper-position/...

The content block is trying to replace URLs with their canonical reference. It appears that c5 cannot find the canonical URL for those pages, and it becomes blank, which is the home page.

The correct cID is entered into the content of the block when you select a page. If you go back to the page and view the HTML in the editor, my guess is that the cID is still listed correctly (e.g., cID=68). That means the content block is correctly storing and retrieving the block content. Double check that to be sure, though.

When the content block renders itself, that is when the cID is converted into the canonical URL. The content block finds the page for the cID and asks the page for its path. The content block tacks the path onto the relative directory and the dispatcher, which should be

/lapdesk2/index.php/<path to the page>

It appears that the page is not returning its path, and the URL becomes

/lapdesk2/index.php/

for all of the pages. To find its path, the page first looks in cache. Since you said that cache is disabled, I assume that the page does not find the path, and then the page looks in the database. The database lookup will fail if it cannot find an approved page. That's why I asked if the page is approved. I asked what was in the box for the canonical URL, because if it was blank, that would equate to the home page.

I'm wondering if there is some problem with your installation. Does the database user have all of the following privileges on all of the Concrete5 database tables?

INSERT, SELECT, UPDATE, INDEX, DELETE, CREATE, DROP, ALTER

Another thing to try would be to temporarily turn on caching and see if that makes a difference. Are there any error messages in the Concrete5 Logs? Are there any error messages in the web server error log?
cursal replied on at Permalink Reply 1 Attachment
cursal
"These URLs don't work, and I think they should. "
--I think they should work too ;)

"the content block is correctly storing and retrieving the block content. Double check that to be sure, though."
--Check and double checked. They are storing.

Agreed, those page links default to index.php after the page is no longer in edit mode and is saved.
What I find intreging is even a normal text link with no code attached to them of any sorts gets converted, as I mentioned in eariler post

I have all privileges set on the MySQL database.
Even double checked to make sure

Nothing the the c5 logs but the one email I sent testing out the contact form.

Something NEW:
I turned on the cache
and
Enabled Pretty URLs
and I then went to edit my .htaccess with the code c5 spits out
When I got there the .htaccess file already had the code in there but with # comments added above and below
with the re-write engine on
looks like c5 4.0 has that in there by default....is that new??
I didn't put it there. Not with comments, I would have remembered that.
Could that have anything to do with my problems?

Also noticed that those pretty URLs don't work.
go head and check the site now.
They still use the cID in the urls.
And my page links still point to index.php

I did pull up some errors. See attached text files.

I'm not sure what a stack trace is or much of what that log file means
And what is that inlinepopups that's missing from the tiny_mce?

Next, I'm going to do a fresh install and just upload my theme and images again.
Then test those pesky page links...again

Thanks mose, you are a rockstar for sticking with me and trying to track it down like a bloodhound 8-)
mose replied on at Permalink Reply
mose
.htaccess is not part of my 5.4.0 installation. Maybe it writes the file automatically when the option is chosen, but I have most directories locked down.

I think that in order for pretty URLs to work for autonav, you need to define URL_REWRITING_ALL to be true in site.php. I will take a look at the attached files to see if there are any clues.
cursal replied on at Permalink Reply
cursal
you need to define URL_REWRITING_ALL to be true in site.php.

I don't have an option to change it to true because it isn't even defined right now...

Should it be there and set as false?
mose replied on at Permalink Reply
mose
I checked the attachment. Several days ago there was a mysql error due to a duplicate key being inserted into the CollectionVersionBlockStyles table of the database. It is unknown if that error is serious. Certainly, there shouldn't be a duplicate key, but it could be that ignoring the duplicate key actually fixes the problem.

The next error is that the following file cannot be found.

/home/x1test/public_html/lapdesk2/concrete/js/tiny_mce/plugins/inlinepopups/skins/concreteMCE/img/horizontal.gif

I don't have the file in my installation, and I don't see any corresponding errors in the logs here. I use the editor in Advanced mode.

The only other problem is that the home page appears to generate this path somewhere on it.

/home/x1test/public_html/lapdesk2/'+imgURL+'

It looks like +imgURL+ is not being translated correctly by the slide show, but that won't affect the links. I don't see anything else that stands out or looks like a problem.

A fresh install would be the best way to go. It's starting to look like there is a problem in one or more tables of the database. Be sure to drop all of the tables, or drop the database and recreate it (backup the database first if it has information you want to save). Create a test page in the vanilla installation to confirm that it is working. Then, test things after each step (e.g., installing a new theme). Hopefully, that will uncover any issues.
afixia replied on at Permalink Reply
afixia
Same problem here, but I've made some observations.

Top Level links seem to be the only problem. If I use Insert Link to Page to any 2nd or 3rd level page it works just fine but the top level seems to be the problem. Even in HTML view the link is correct but when you publish, it goes nuts and links it back to the homepage.

I have made another observation. My top level links aren't going to alias address but to the IDs while 2nd and 3rd level page links are properly targeting the alias address.

I have many 5.3.3.1 installation with no problems, but this is my first 5.4 and this is causing me some major concern since I'm building an expensive website in it.
cursal replied on at Permalink Reply
cursal
All my links to pages do not work.
Parent or child pages or child child to parent or parent's parents (Tippy Top :) )

I too have my concerns about 5.4 right now.
I have no idea what to do with the site except rebuild it?

I would love to save the site structure and pages, but not sure how to pull that out of the database.

Shucks..I wish I knew what cause that MySQL error :(

I don't want to have it happen again.

5.3.3.1 worked without a problem for many sites. Upgraded to 5.4 I have rebuilt them all.
ugh.
Until I know what's causing this those other sites are sticking with 5.3.3.1

If you have a solution I would appreciate hearing it.
afixia replied on at Permalink Reply
afixia
Sorry man, spent some time on it last night and this morning, no solution. I don't have time to waste, so I'm just installing 5.3.3.1 and doing all my work over :(
SteveAtParadigm replied on at Permalink Reply
I'm having the same issue, but with only a single link on a single page, and its at the third level down in the hierarchy.

For now I just pasted the content code into an HTML block, and it works, but my client can't edit that block of course.
andrew replied on at Permalink Best Answer Reply
andrew
I haven't read all messages in this thread but I think I have a fix.

Open concrete/blocks/content/controller.php

and change

private function replaceCollectionID($match) {
$cID = $match[1];
if ($cID > 0) {
$path = Page::getCollectionPathFromID($cID);
if (URL_REWRITING == true) {
$path = DIR_REL . $path;
} else {
$path = DIR_REL . '/' . DISPATCHER_FILENAME . $path;
}
return $path;
}
}

to

private function replaceCollectionID($match) {
$cID = $match[1];
if ($cID > 0) {
$c = Page::getByID($cID, 'APPROVED');
return Loader::helper("navigation")->getLinkToCollection($c);
}
}

This only affects sites where, for some reason, page paths aren't working, and the linked page is one without a path. This will be fixed publicly in 5.4.0.6.