Re: permalink use record 'num' field

9 posts by 2 authors in: Forums > CMS Builder
Last Post: June 30, 2020   (RSS)

By pixelMIGHT(Josh) - June 15, 2020

In response to: https://www.interactivetools.com/forum/forum-posts.php?postNum=2242238#post2242238

Hi. Was there a resolution to this? I'm actually having this same issue.

I've permalinks.php to be: 

$GLOBALS['PERMALINKS']['autopopulate_fromFields'] = array('num');

but I get "You must enter a value for 'permalink'!"

Is the issue that the record doesn't know what 'num' it is until it's saved? Is there a work around for this? We don't have titles for these records. It's really just a bunch of images in each record. 

By pixelMIGHT(Josh) - June 17, 2020

Thanks, Damon. 

Yes, I'm really just looking for a unique permalink that is "pretty". I'm mostly just trying to get a better solution than the default query link like (.php?xxx). I would like it to be fairly short, whatever it is, but the long date sequence would do, if that is the only option. SEO is not a concern for this site as the client is only using it as a portfolio to direct people to that he has already had contact with. 

Sound like maybe you have something in mind? 

Josh

By Damon - June 17, 2020

Hi Josh,

Just tried using the createdDate value for the permalink and that didn't work. Looking into any other possible options and will let you know what I can come up with.

Cheers,
Damon Edis - interactivetools.com

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

By Damon - June 18, 2020

Hi Josh,

Here are the steps to create and have a unique number that can be used for your permalinks:

1. Create a new text field called Date (this can be named whatever you like).

2. Under Field Options, set the Default Value as

<?php echo date("Ymdhs"); ?>

3. In the permalinks.php file, update this line to use the date field value:

$GLOBALS['PERMALINKS']['autopopulate_fromFields'] = array('date'); // the first field in this list with content will be used to create the permalinks. To use multiple fields separate them with spaces​

4. Now when you create a new record, the Date field will display the current date, time, seconds like this: 202006180543

5. On save, this value will be used as the permalink.

Give this a try and let me know if you have any questions.

Cheers,
Damon Edis - interactivetools.com

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

By pixelMIGHT(Josh) - June 20, 2020

Thanks, Damon. I just wanted to drop a quick note that it'll be a few days before I can give this a try. I'll let you know how it goes as soon as I do, though. 

Josh

By pixelMIGHT(Josh) - June 29, 2020

Hi Damon, 

This isn't working for me. I actually had to change 'date' to 'item' due to a warning about 'date' being a reserved field name. 

The auto creation of the date string does work, but it doesn't seem to be acknowledging the field as a permalink. It just takes me to the 404 page. 

If you hover over one of the images here you'll see what I mean: https://affordablehomerenovations.com/projects

I have my detail page url set to /project-details.php. And when I use the link with the the query it works. 

But when I use this link it does not:

<a href="/<?php echo htmlencode($record['item']) ?>" target="_self">


What am I missing? 

Thanks. 

By Damon - June 30, 2020

Hi Josh,

I viewed the source of this page:
https://affordablehomerenovations.com/projects

and this is the code for the images:

<a href="#">
<img alt="" src="img/gallary-02.jpg" data-image="img/gallary-02.jpg" data-description="Those are peppers" style="display:none">
</a>

I don't see anything ouput for the link.

Am I looking at the right page?

Cheers,
Damon Edis - interactivetools.com

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

By pixelMIGHT(Josh) - June 30, 2020

Hi Damon, 

I have a guy working on the site and he must have changed it back. I'll see what happens when he gives it a try and get back to you. 

Sorry  about  the  confusion.