如何编写改变控制面板主题颜色方案的插件?

时间:2015-09-22 11:10:48

标签: java css liferay velocity liferay-theme

将主题设置为控制面板的主要主题(控制面板 - >配置 - >门户网站设置 - >显示设置 - >外观和感觉)后,没有选项可以选择我的任何颜色方案带有主题,

如何编写插件才能选择配色方案?

2 个答案:

答案 0 :(得分:0)

Thanks guys i was able to solve this by adding JavaScript Code (<?php if(isset($_GET['action']) && $_GET['action']=="add") { $id=intval($_GET['id']); if(isset($_SESSION['cart'][$id])){ $_SESSION['cart'][$id]['quantity']++; } else { $sql_s="SELECT * FROM products WHERE id_product={$id}"; $query_s=mysqli_query($con,$sql_s); if(mysqli_num_rows($query_s)!=0) { $row_s=mysqli_fetch_array($query_s); $_SESSION['cart'][$row_s['id_product']]=array ( "quantity" => 1, "price" => $row_s['price'] ); } else { $message="This product id it's invalid!"; } } } ?> <h1>Product List</h1> <?php if(isset($message)){ echo "<h2>$message</h2>"; } ?> <table> <?php $sql = "SELECT * FROM products ORDER BY name ASC"; $query = mysqli_query($con,$sql); while ($row=mysqli_fetch_array($query)) { ?> <tr> <td><?php echo $row['name'] ?></td> <td><?php echo $row['description'] ?></td> <td><?php echo $row['price'] ?>$</td> <td><a href="index.php?page=products&action=add&id=<?php echo $row['id_product'] ?>">Add to cart</a></td> </tr> <?php } ?> </table> ), in the JQuery file of the theme that execute on page load and detect the main.js and change the class of Control panel to the Color defined in the <body>.

答案 1 :(得分:-1)

解决此问题的方法之一是使用 Theme Setting API of Liferay

您可以在相应主题的 liferay-look-and-feel.xml read this value in vm templates中提供颜色选项,并通过portal_normal.vm

将颜色应用于相应的HTML元素

以下几条链接供您参考:

希望这有帮助。