Page link in the admin

11 posts by 4 authors in: Forums > CMS Builder
Last Post: July 7, 2010   (RSS)

By Vaisoco - June 29, 2010

Hi,

Is there any way to show the value of _link variable in the admin, so the user knows how to link to particular record? If so can it be shown in a nice SEO way?

Thanks

Re: [Vaisoco] Page link in the admin

By Jason - June 29, 2010

Hi,

Since the _link variable is not actually a database field, but a variable that's created when you use the getRecords function, you can't display it directly in the "edit" page of a record. However, there's a work around.

If you know the name of the file that they're using to display details (details.php for this example) and you know the field that they store the name of the record in (title in this example), you can use a separator to display this information.

Add a separator field, make sure that you select the "HTML" radio button.

In the text box below that, put the following code:

<tr>
<td>
link:
</td>
<td>
details.php?<?php
echo str_replace(" ","-",$record['title'])."-".$record['num'];
?>
</td>
</tr>


This will display in the admin section as the link for details.php, it will replace all the spaces in the title with a "-" and append the record number to the end of the link.

So, for example, if the product was called "my new product" and had a record number of 3, this is what will be displayed:
details.php?my-new-product-3

It's important that the record number appear at the end of the query string.

Give it a try and let me know if you run into any issues.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Page link in the admin

By flamerz - June 29, 2010

i get "undefined variable record".

sorry about my jump to this post [pirate]

im interested in this too

Re: [flamerz] Page link in the admin

By Jason - June 29, 2010

Hi,

Can you copy and paste the code that you're using in your separator?

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Page link in the admin

By flamerz - June 29, 2010

this:

<tr>
<td>
Print Invoice:
</td>
<td>
../invoice.php?<?php
echo $record['num'];
?>
</td>
</tr>

Re: [flamerz] Page link in the admin

By Jason - June 29, 2010

Hi,

Is this happening when you're trying to create a new record?

Try changing your code to this:

<tr>
<td>
Print Invoice:
</td>
<td>
<?php if($record):?>
../invoice.php?<?php
echo $record['num'];
?>
<?php endif ?>
</td>
</tr>


If you're creating a new record, then $record has no value yet. This change will only display information if the record has been created.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [flamerz] Page link in the admin

By Jason - June 30, 2010

Hi,

If you could email me your CMS login and FTP details to jason@interactivetools.com, I can take a closer look at it.

Only email this information, don't post it to the forum.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Page link in the admin

By flamerz - June 30, 2010 - edited: June 30, 2010

wops!

Jason, your code works fine.. but NOT work in the latest CMSB beta!

i post a message in the beta test to this thread.

thanks!!!

Re: [flamerz] Page link in the admin

By Chris - July 6, 2010

Hi flamerz,

You'll need to use $RECORD instead of $record in the latest beta.

I hope this helps! Please let us know if you have any questions.
All the best,
Chris