1
zivXP
Restrict the "title" field
  • 2023/8/10 11:51

  • zivXP

  • Not too shy to talk

  • Posts: 113

  • Since: 2006/2/9 1


How can I limit the "title" field in admin-form of "news 1.66" module to 80 characters?
In which file can this be done?

I've been trying to figure it out: modules\news\admin\index.php
case 'newarticle':
xoops_cp_header();
news_adminmenu(1);
include_once XOOPS_ROOT_PATH . '/class/module.textsanitizer.php';
newSubmissions();
autoStories();
lastStories();
expStories();
echo '<h4>' . _AM_POSTNEWARTICLE . '</h4>';
$type = 'admin';
$title = ''; - Is there any way to change this to limit the length of the field?
$topicdisplay = 0;

But that's probably not how it's done.

2
goffy
Re: Restrict the "title" field
  • 2023/8/10 16:21

  • goffy

  • Just can't stay away

  • Posts: 535

  • Since: 2010/12/27


hi

you can add a truncate in your template file
e.g. <{$title|truncate:80}>

3
zivXP
Re: Restrict the "title" field
  • 2023/8/11 12:15

  • zivXP

  • Not too shy to talk

  • Posts: 113

  • Since: 2006/2/9 1


I did what I needed to do. Maybe someone else will need it.
modules/news/include
edit files storyform.inc.php and storyform.original.php

$sform = new XoopsThemeForm(_NW_SUBMITNEWS, "storyform", XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/submit.php');
$sform->setExtra('enctype="multipart/form-data"');
$sform->addElement(new XoopsFormText(_NW_TITLE, 'title', 50, 255, $title), true);

replace 255 with 80

This is done for a news aggregator, as conditions have changed there.

4
zivXP
Re: Restrict the "title" field
  • 2023/8/11 12:22

  • zivXP

  • Not too shy to talk

  • Posts: 113

  • Since: 2006/2/9 1


Quote:

goffy wrote:
hi

you can add a truncate in your template file
e.g. <{$title|truncate:80}>


Thanks!

5
Mamba
Re: Restrict the "title" field
  • 2023/8/12 7:48

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


Why? What's the reason?
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

6
zivXP
Re: Restrict the "title" field
  • 2023/8/12 20:21

  • zivXP

  • Not too shy to talk

  • Posts: 113

  • Since: 2006/2/9 1


Quote:

Mamba wrote:
Why? What's the reason?


This is done for a news aggregator (dzen.ru ). Their conditions have changed.

Login

Who's Online

136 user(s) are online (100 user(s) are browsing Support Forums)


Members: 0


Guests: 136


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits