Re: permalink use record 'num' field

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

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 Damon - June 17, 2020

Hi,

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. 

Yes, the issue is that 'num' doesn't exist until the record is saved. The permalink would have to be created post save which would have some challenges to setup.

I'm wondering if using the created date would work. That would be a long string of numbers.

Are you just looking for a unique permalink?

Cheers,
Damon Edis - interactivetools.com

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

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/

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 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/

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.