article submit - show on frontpage default value

Need help with the Administration of your Joomla! 1.5 site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
simisch
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Tue Jul 17, 2007 12:07 pm

article submit - show on frontpage default value

Post by simisch » Sun Sep 28, 2008 8:14 pm

Hi,

where can I change the default value of the radiobutton 'show on frontpage' in the article submit page? I want to set it to true ...

thanks for helping

 
User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11445
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: article submit - show on frontpage default value

Post by ooffick » Mon Sep 29, 2008 10:24 am

Hi, do you want to change that in the front end or in the back end.

If you want to change that in the front end, you can do that with the template overwrites:

  1. create a folder in your template folder called "html" (if it doesn't exists)
  2. create a folder in that html folder called "com_content" (if it doesn't exists)
  3. create a folder in that com_user folder called "article" (if it doesn't exists)
  4. copy the file .../components/com_content/views/article/tmpl/form.php in this .../templates/[your-template]/html/com_content/article/ folder
  5. edit that file accordingly
To change the back end default option, you cannot do that without changing the core file.

Olaf
Olaf Offick - Global Moderator
learnskills.org

User avatar
tw
Joomla! Intern
Joomla! Intern
Posts: 70
Joined: Wed Dec 13, 2006 10:32 am

Re: article submit - show on frontpage default value

Post by tw » Sat Nov 15, 2008 9:45 pm

Hi
In joomla 1.5 you find the value to change default "show on frontpage" in components/com_content/views/article/view.html.php

change this code:

Code: Select all

else {    $article->frontpage = 0;    }
To this:

Code: Select all

else {     $article->frontpage = 1;   }
0 is for default "No"
1 is for default "Yes"

That should do it! :D

User avatar
urwie
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Mar 20, 2009 6:43 pm

Re: article submit - show on frontpage default value

Post by urwie » Fri Mar 20, 2009 6:56 pm

If you want to do the same thing for situations in which you create an new article from the backend, then you can do that by making some modification in controller.php (administrator/components/com_content/controller.php)

Line:532

$lists['frontpage'] = JHTML::_('select.booleanlist', 'frontpage', '', $row->frontpage);

Please make above code as follows:

if (!$edit) $row->frontpage = 1;
$lists['frontpage'] = JHTML::_('select.booleanlist', 'frontpage', '', $row->frontpage);

(So you add " if (!$edit) $row->frontpage = 1; " above the line)

:geek: :pop
Test everything. Hold on to the good. (1Th 5:21)

joePIPed
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sun Mar 02, 2008 7:40 pm

Re: article submit - show on frontpage default value

Post by joePIPed » Tue Mar 30, 2010 1:41 am

urwie wrote:If you want to do the same thing for situations in which you create an new article from the backend, then you can do that by making some modification in controller.php (administrator/components/com_content/controller.php)

Line:532

$lists['frontpage'] = JHTML::_('select.booleanlist', 'frontpage', '', $row->frontpage);

Please make above code as follows:

if (!$edit) $row->frontpage = 1;
$lists['frontpage'] = JHTML::_('select.booleanlist', 'frontpage', '', $row->frontpage);

(So you add " if (!$edit) $row->frontpage = 1; " above the line)

:geek: :pop
That works in the backend, but it doens't work for submitting articles in the frontend. Is there a way to do it so it works in the frontend?

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11445
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: article submit - show on frontpage default value

Post by ooffick » Tue Mar 30, 2010 7:38 am

Did you check the template overwrite option?

Olaf
Olaf Offick - Global Moderator
learnskills.org

JonBrant
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Sun Apr 27, 2008 1:35 am

Re: article submit - show on frontpage default value

Post by JonBrant » Fri Sep 10, 2010 10:04 am

joePIPed, tw's post does what you're after.

I just wanted to thank both tw and ooffick. Each method works with no side effects that I can see in my 1.5.15 installation. I was worried that they might make ALL articles appear on the front page regardless of the radio button value, and (for anyone else wondering the same) they do not

crashy1984
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Tue Mar 29, 2011 6:28 pm

Re: article submit - show on frontpage default value

Post by crashy1984 » Wed Mar 30, 2011 9:19 am

sorry for grabbing this old post...

but i have made both changes (tw's change and urwie's change) but it has no effect on my site (Joomla!1.5.17, i know i should do an update...)

backend -> add new article -> frontpage = NO (default)
frontend -> write new article -> frontpage = NO (default)

which editor did you use?

i use latest version of JCE...

did i made something wrong or is it not possible anymore to change the default value of frontpage option?
http://www.gau-gaming.de | Multigaming Community

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11445
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: article submit - show on frontpage default value

Post by ooffick » Wed Mar 30, 2011 9:33 am

So which files did you change?

Olaf
Olaf Offick - Global Moderator
learnskills.org

crashy1984
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Tue Mar 29, 2011 6:28 pm

Re: article submit - show on frontpage default value

Post by crashy1984 » Wed Mar 30, 2011 10:32 am

(administrator/components/com_content/controller.php)

Line:532

Code: Select all

$lists['frontpage'] = JHTML::_('select.booleanlist', 'frontpage', '', $row->frontpage);
Please make above code as follows:

Code: Select all

if (!$edit) $row->frontpage = 1;
$lists['frontpage'] = JHTML::_('select.booleanlist', 'frontpage', '', $row->frontpage);
(So you add " if (!$edit) $row->frontpage = 1; " above the line)


AND:

components/com_content/views/article/view.html.php

change this code:

Code: Select all

else {    $article->frontpage = 0;    }
To this:

Code: Select all

else {     $article->frontpage = 1;   }
both did not tke the effect i would like to...
http://www.gau-gaming.de | Multigaming Community

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11445
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: article submit - show on frontpage default value

Post by ooffick » Wed Mar 30, 2011 12:08 pm

Hi,

ok, without your previous hacks, can you try the following template overwrite:
  1. create a folder in your template folder called "html" (if it doesn't exists)
  2. create a folder in that html folder called "com_content" (if it doesn't exists)
  3. create a folder in that com_content folder called "article" (if it doesn't exists)
  4. copy the file .../components/com_content/views/article/tmpl/form.php in this .../templates/[your-template]/html/com_content/article/ folder
  5. open that file
  6. find the following lines:

    Code: Select all

    <?php echo $this->lists['frontpage']; ?>
  7. and replace it with the following:

    Code: Select all

    <?php if($this->article->id) {echo $this->lists['frontpage'];} else { echo JHTML::_('select.booleanlist', 'frontpage', '', 1); } ?>
  8. save the file

Olaf
Olaf Offick - Global Moderator
learnskills.org

crashy1984
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Tue Mar 29, 2011 6:28 pm

Re: article submit - show on frontpage default value

Post by crashy1984 » Wed Mar 30, 2011 12:48 pm

this works perfect for the frontend. that most i would like to use. backend is not so necessary for us... thank you very much!
http://www.gau-gaming.de | Multigaming Community

 

Locked

Return to “Administration 1.5”