How to show button instead of whole link inside content

InstantCMS 2.X
#1 12 декабря 2019 в 20:47
Hello brothers and greetings from Serbia smileI just started using InstantCMS and so far I like it very much because you have full control over content and there is soo much options which is great, just love it love

I created content type and added Link field type and my question is how to show button inside content instead of the whole link, example:

(Dont want this) Link:

(I want to show it as button with my own title, like this) Link: Go to this link

Hope someone understand me, I can read Russian but dont understand every word so documentation is not much useful for me sad

I did try to find solution inside your docs but without any luck. I understand HTML and CSS, but dont know which file to edit so I can accomplish this scratch
#2 12 декабря 2019 в 20:57
#3 12 декабря 2019 в 21:26
Thanks for your help AndroS smile, I know about that option but need to add title to link button automatically smile

See I marked that field validation as Required and as URL so when I click Save then I am getting error because its not valid url (Example: google.com|Google).

I am sure that I need to edit some file and add code to it but not sure which one.

Would be nice to add input field where we could add custom title for our link. For example:

Link CSS class: button
Custom link title: Go to this page or whatever we want to enter
#4 12 декабря 2019 в 21:52

I am sure that I need to edit some file and add code to it but not sure which one.

@Alex85
Постоји могућност додавања css класе. Можете додати слику са позадинским дугметом за ову ставку менија.
#5 12 декабря 2019 в 22:25
Hvala Ris zst, pronašao sam rešenje smile

Well I found solution, under system/fields/url.php line 79:

  1. return '<a rel="noopener'.$nofollow.'" target="_blank" '.$class.' href="'.htmlspecialchars($href).'">'.htmlspecialchars($value).'</a>';
Just edit like this:

  1. return '<a rel="noopener'.$nofollow.'" target="_blank" '.$class.' href="'.htmlspecialchars($href).'">'.htmlspecialchars("Go to this link or whatever you want to put in here").'</a>';
Thanks much for your help guys dance
#6 14 декабря 2019 в 23:40
One more question zst

How to manually add content type custom field?

I see they are auto loaded (default_item.tpl.php) but because of the design I want and I need to add them manually hoho
#7 15 декабря 2019 в 09:37
#9 16 декабря 2019 в 01:56
Ok, I found solution for this. I know how to add fields smile

If you want to put your field where you want then you can do it like this:

  1. <?php echo $fields['link']['html']; ?>
In my case I have field called link and you should use name that you set inside system name smile

Or you can use it like this without html and set your own design:

  1. <?php echo $item['link']; ?>
Hope this is the right way because its working fine for me popcorn
Вы не можете отвечать в этой теме.
Войдите или зарегистрируйтесь, чтобы писать на форуме.
Используя этот сайт, вы соглашаетесь с тем, что мы используем файлы cookie.